如何使用AsciiDoctor创建自定义类HTML部门?

tra*_*ant 8 asciidoc asciidoctor

我从AsciiDoctor开始,我想输出HTML.我一直试图弄清楚如何在分区中创建自定义类,我搜索谷歌,手册等,但找不到解决方案.我想做的只是写下这样的东西:

Type the word [userinput]#asciidoc# into the search bar.

哪个生成HTML

<span class="userinput">asciidoc</span>

但我想要div标签而不是span.有什么方法可以做到或者我应该使用类似的东西 +++<div class="userinput">asciidoc</span>+++吗?

Jmi*_*ini 6

我认为你所需要的在Asciidoctor中被称为"角色".

这个例子:

This is some text.

[.userinput]
Type the word asciidoc into the search bar.

This is some text.
Run Code Online (Sandbox Code Playgroud)

生产:

<div class="paragraph">
<p>This is some text.</p>
</div>
<div class="paragraph userinput">
<p>Type the word asciidoc into the search bar.</p>
</div>
<div class="paragraph">
<p>This is some text.</p>
</div>
Run Code Online (Sandbox Code Playgroud)

你现在有一个div.userinput相关div 的css选择器.

13.5.在Asciidoctor用户手册中设置元素的属性(您也可以搜索"角色").


Syl*_*oux 5

为此,您可能需要使用开放块

Type the following commands:

[.userinput]
--
command1

command1
--
Run Code Online (Sandbox Code Playgroud)

生产:

<div class="paragraph">
  <p>Type the following commands:</p>
</div>
<div class="openblock userinput">
  <div class="content">
    <div class="paragraph">
      <p>command1</p>
    </div>
    <div class="paragraph">
      <p>command1</p>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

优点是它可以包装任何其他块,并且不像其他答案那样仅限于一个段落。

对于稍微不同的用例,您还可以考虑定义自定义样式