UNPKG

611 BJavaScriptView Raw
1/**
2 @overview Escape HTML tags in descriptions.
3 @module plugins/escapeHtml
4 @author Michael Mathews <micmath@gmail.com>
5 */
6'use strict';
7
8exports.handlers = {
9 /**
10 Translate HTML tags in descriptions into safe entities.
11 Replaces <, & and newlines
12 */
13 newDoclet: function(e) {
14 if (e.doclet.description) {
15 e.doclet.description = e.doclet.description
16 .replace(/&/g, '&amp;')
17 .replace(/</g, '&lt;')
18 .replace(/\r\n|\n|\r/g, '<br>');
19 }
20 }
21};