使用 Maven 插件将 asciidoc 转换为 html5 时如何启用(自定义)警告图标

How to enable (custom) admonition icons when converting asciidoc to html5 using the maven plugin

我使用 asciidoctor-maven-plugin(1.5.3) 将 asciidoc 文件转换为 pdf 和 html 文件。

问题:

渲染创建的 pdf 文件包括警告图标 - 所以,一切都很好。

另一方面,html 文件似乎没有以正确的方式创建 - 警告图标丢失。没有 text/caption 而只是一个奇怪的占位符。

我尝试使用 :icons: font backend attribute,其中 font 是我在 asciidoc 文档中找到的唯一选项。 (顺便说一下,这与在 pom.xml. 中添加 <icons>font</icons> 相同)

font 选项应该显示来自 http://fortawesome.github.io/Font-Awesome/icons/ 的图标,但它没有。

问题:

我是否必须从任何地方导入这些图标或下载它们并使用 :iconsdir: path/to/icons backend attribute 专门包含它们?


pom.xml 的重要部分如下所示。

<configuration>
    <backend>html5</backend>
    <sourceHighlighter>coderay</sourceHighlighter>
  <attributes>
    <imagesdir>./images</imagesdir>
    <toc>left</toc>
    <icons>font</icons> 
    <sectanchors>true</sectanchors>
    <idprefix/>
    <idseparator>-</idseparator>        
  </attributes>
</configuration>

好吧,这很尴尬,至少故事的一半。

  1. 尴尬的部分

我犯的实际错误是使用 noscript firefox plugin,它不允许使用 fontawesome...

事实上,我必须在 noscript 中明确允许 cloudfare.com 才能正常工作。

因此,我的 pom.xml 保留了属性 <icons>font</icons>

  1. 好的部分

我了解了如何使用自定义图标:

  • 声明<iconsdir>./images/icons</iconsdir>(这也是默认的,相对于源目录。)
  • 复制里面的一些图标。我从 here 得到它们。 (注意名字:note.png for NOTE: This is a note.
  • <icons>font</icons>更改为<icons>image</icons>