Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include a javascript in Asciidoc?

I'm using asciidoctor-maven-plugin to convert .adoc files to html file... Would want to include a link to javascript in the generated html file... Basically would like to see something like below in the html file that is generated from the .adoc file

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

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

Any help?

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

But then have to add it in every .adoc file...is there a way to get it automatically added just like the CSS (using stylesheet)

like image 543
Karthik Avatar asked Oct 20 '14 14:10

Karthik


People also ask

How do I add a hyperlink in AsciiDoc?

To define a link in Asciidoc markup we only have to type the URL followed by an optional text for the link in square brackets ( [text link] ).

Is AsciiDoc better than markdown?

The AsciiDoc syntax is more concise than (or at least as concise as) Markdown. At the same time, AsciiDoc offers power and flexibility without requiring the use of HTML or “flavors” for essential syntax such as tables, description lists, admonitions (tips, notes, warnings, etc.) and table of contents.

Is AsciiDoc a markup language?

AsciiDoc is a plain text markup language for writing technical content. It's packed with semantic elements and equipped with features to modularize and reuse content. AsciiDoc content can be composed using a text editor, managed in a version control system, and published to multiple output formats.


1 Answers

Use docinfo files, see the documentation for more detail.

You create docinfo files by adding another file named <doc_file_name>-docinfo.html for HTML generation or <doc_file_name>-docinfo.xml for docbook generation. The contents of the docinfo file are copied into the generated output, in the head section for html. If you want to add things to the bottom of the document there are footer docinfo files for that. It follows the same as a normal 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 the list know of any other maven issues you find.

like image 110
LightGuard Avatar answered Oct 04 '22 01:10

LightGuard