如何在 asciiDoctor 的列表块中编写一些 html 代码?
How write some html code inside a listing block in asciiDoctor?
可以在列表块中添加圆顶 html 代码吗?
我有一个这样的文件:
----
Blablabla
+++<b>This has to be interpreted as HTML</b>+++
<span>This has not to be interpreted as HTML but as TEXT</span>
----
打印如下:
Blablabla
+++<b>This has to be interpreted as HTML</b>+++
<span>This has not to be interpreted as HTML but as TEXT</span>
但应该这样打印:
Blablabla
This has to be interpreted as HTML
<span>This has not to be interpreted as HTML but as TEXT</span>
有人知道如何实现吗?
代码块默认禁用大多数 Asciidoctor 替换。但是您可以控制应该为任何特定块启用哪些替换。
对于您的示例,在您的代码块之前添加 [source,subs="+macros"]
行:
[source,subs="+macros"]
----
Blablabla
+++<b>This has to be interpreted as HTML</b>+++
<span>This has not to be interpreted as HTML but as TEXT</span>
----
有关替换的更多信息,请参阅:https://asciidoctor.org/docs/user-manual/#subs
特别是:https://asciidoctor.org/docs/user-manual/#applying-substitutions
可以在列表块中添加圆顶 html 代码吗?
我有一个这样的文件:
----
Blablabla
+++<b>This has to be interpreted as HTML</b>+++
<span>This has not to be interpreted as HTML but as TEXT</span>
----
打印如下:
Blablabla
+++<b>This has to be interpreted as HTML</b>+++
<span>This has not to be interpreted as HTML but as TEXT</span>
但应该这样打印:
Blablabla
This has to be interpreted as HTML
<span>This has not to be interpreted as HTML but as TEXT</span>
有人知道如何实现吗?
代码块默认禁用大多数 Asciidoctor 替换。但是您可以控制应该为任何特定块启用哪些替换。
对于您的示例,在您的代码块之前添加 [source,subs="+macros"]
行:
[source,subs="+macros"]
----
Blablabla
+++<b>This has to be interpreted as HTML</b>+++
<span>This has not to be interpreted as HTML but as TEXT</span>
----
有关替换的更多信息,请参阅:https://asciidoctor.org/docs/user-manual/#subs
特别是:https://asciidoctor.org/docs/user-manual/#applying-substitutions