How to enable javascript in Asciidoc?

I use asciidoctor-maven-plugin to convert .adoc files to html file ... I would like to include a javascript link in the generated html file ... Basically, I would like to see something like below in the html file that is created from the file. adoc

<script src="custom.js"></script> 

Tried setting attributes like linkcss scriptsdir etc. but no luck ...

Any help?

One way, as in http://mrhaki.blogspot.ie/2014/06/awesome-asciidoc-include-raw-html.html

But then you need to add it to every .adoc file ... there is a way to get it automatically added in the same way as CSS (using the stylesheet)

+5
source share
2 answers

Use docinfo files, see the documentation for more details .

You create docinfo files by adding another file named <doc_file_name>-docinfo.html to generate HTML or <doc_file_name>-docinfo.xml to generate docbook. The contents of the docinfo file are copied to the generated output in the head section for html. If you want to add something to the bottom of the document, there are footer docinfo files for this. It follows the same way as regular docinfo, but the file name is <doc_file_name>-docinfo-footer.html or <doc_file_name>-docinfo-footer.xml

Happy docing :) Let me, or preferably on the list, find out about any other maven issues you find.

+5
source

You can use the forwarder to do this with ++++ :

 ++++ <p> Content in a passthrough block is passed to the output unprocessed. That means you can include raw HTML, like this embedded Gist: </p> <script src="http://gist.github.com/mojavelinux/5333524.js"> </script> ++++ 

Source: http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#more-delimited-blocks

+3
source

Source: https://habr.com/ru/post/1205095/


All Articles