toHTML.js 857 B

1234567891011121314151617181920212223
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const asciidoctor_1 = __importDefault(require("asciidoctor"));
  7. const asciidoctor = (0, asciidoctor_1.default)();
  8. // Render Asciidoc to HTML (block)
  9. const asciidocToHTML = (content, options) => {
  10. return asciidoctor.convert(content, {
  11. safe: "server",
  12. attributes: { showtitle: "", icons: "font@" },
  13. base_dir: options?.baseDirectory
  14. });
  15. };
  16. // Render Asciidoc to HTML (inline)
  17. const asciidocToHTMLInline = (content, options) => {
  18. return asciidoctor.convert(content, { doctype: "inline", base_dir: options?.baseDirectory });
  19. };
  20. exports.default = {
  21. block: asciidocToHTML,
  22. inline: asciidocToHTMLInline
  23. };