neo4j-contrib / graphgist-portal-v3

GraphGist Portal v3 (JavaScript)
Apache License 2.0
5 stars 4 forks source link

Code simplification, call Document#convert after Asciidoctor#load #49

Open ggrossetie opened 3 years ago

ggrossetie commented 3 years ago

The following code can be simplified:

https://github.com/neo4j-contrib/graphgist-portal-v3/blob/20efc9c0d19455e7ebc231b98c936fabff8fd83b/api/src/graphgists/utils.js#L88-L96

Once a Document is loaded, we can call the function convert on it:

const doc = asciidoctor.load(asciidoc)
doc.setAttribute("toc", "macro")
doc.setAttribute("toc-placement", "macro") 
doc.setAttribute("env-graphgist", "true")
const rawHtml = doc.convert()