如何在Asciidoc中包含一个javascript? [英] How to include a javascript in Asciidoc?

查看:97
本文介绍了如何在Asciidoc中包含一个javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用asciidoctor-maven-plugin将.adoc文件转换为html文件...
想在生成的html文件中包含javascript链接...
基本上想要在.adoc文件生成的html文件中看到类似下面的内容

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>

尝试过设置属性,比如linkcss scriptsdir等...但是没有运气......

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

任何帮助?

一种方式就像
http://mrhaki.blogspot.ie/2014/06/awesome-asciidoc-include-raw-html.html

但是必须在每个.adoc文件中添加它...有没有办法让它像CSS一样自动添加(使用样式表)

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)

推荐答案

你可以使用 ++++ 来使用passthrough块:

You can use the passthrough block for that using ++++:

++++
<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>
++++

资料来源: http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#more-delimited-blocks

这篇关于如何在Asciidoc中包含一个javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆