Get list of includes in a parsed document

36 Views Asked by At

I'm parsing an asciidoc document using asciidoctor.js library. The document has doctype of book. I need to get list of all the included documents (asciidoc) in this book doc.

Although, the library gives API for accessing document's includes but it does not return any useful/meaningful data. Here's what I tried:

const doc = asciidoctor().loadFile('/path/to/asciidoc/book')
if (doc.getDoctype() === 'book') {
    console.log(doc.getReferences().includes)
}

This logs following output:

klass {
  '$$smap': {},
  '$$map': [Object: null prototype] {},
  '$$keys': []
}

I double checked and the book document which is being parsed already has some includes in it.

How do you access list of included documents with asciidoctor.js ?

0

There are 0 best solutions below