asciidoctor.js icon indicating copy to clipboard operation
asciidoctor.js copied to clipboard

Add the JavaScript API on the CompositeConverter.

Open xdavidson opened this issue 3 years ago • 0 comments

I am trying out a pug template, for some reason, I can't get the toc to show up. Here are my .pug files:

[llu@llu pug-templates {asciidoctorjs_templates *}]$ cat document.html.pug
html(lang='en')
 head
 - const document = node.getDocument()
   title #{doctitle}
   link(rel="preconnect" href="https://fonts.googleapis.com")
   link(rel="preconnect" href="https://fonts.gstatic.com")
   link(rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Red+Hat+Display:ital,wght@0,400;0,500;0,700;1,400;1,700&family=Red+Hat+Text:ital,wght@0,400;0,700;1,400;1,700&display=swap")
 - const documentId = document.getId()
 body(id=documentId, class="rhdocs")
   include block_toc.pug
   PARA !{ node.getContent() }
[llu@llu pug-templates {asciidoctorjs_templates *%}]$ cat block_toc.pug

- const attr_toc=document.attr
  div.test
    =attr_toc
  - const documentConverter = document.getConverter()
  if documentConverter
    pre #{JSON.stringify(documentConverter)}
    - const html_toc=documentConverter.convert(node, 'outline')
      div.test2
        =html_toc


Asciidoctor.js complains that "documentConverter.convert is not a function"

xdavidson avatar Aug 01 '22 20:08 xdavidson