@podlite/schema
Version:
AST tools for Podlite markup language
29 lines • 700 B
JavaScript
/**
* HTML writer
*/
import Writer from './writer';
class WriterHTML extends Writer {
constructor(output) {
super(output);
}
escape(string) {
const HTML_CHARS = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'/': '/',
'`': '`',
};
return (string + '').replace(/[&<>"'\/`]/g, match => HTML_CHARS[match]);
}
_add_nesting(n) {
this.writeRaw('<blockquote>'.repeat(n));
}
_remove_nesting(n) {
this.writeRaw('</blockquote>'.repeat(n));
}
}
export default WriterHTML;
//# sourceMappingURL=writerHtml.js.map