Asciidoctor:在themes yml中激活章节编号是否可能

huangapple go评论47阅读模式
英文:

Asciidoctor: Is it possible to activate section numbering in themes yml

问题

我知道我可以在标题后使用:sectnums: all来启用节和子节的编号。但是否可以在主题的yml中定义这个?我有很多文档都使用相同的主题文件,只定义一次会很方便。

英文:

I know that I can use :sectnums: all after the title to enable section and subsection numbering. But is it possible to define this in the theme yml? I have a lot documents which use the same theme file, and it would be nice to have it defined only once.

答案1

得分: 1

PDF的theme.yml不支持设置AsciiDoc属性,所以那种方法行不通。

然而,你可以通过命令行来指定属性:

asciidoctor-pdf -a sectnums=all file.adoc

也许最好创建一个仅定义属性的AsciiDoc文件,比如attributes.adoc。你可以在其中指定你想要全局使用的属性:

:sectnums: all
:toc: left

然后,在每个需要使用这些属性的文档中:

= 我的文档
include::attributes.adoc[]

Lorem ipsum...

一旦你为所有文档完成了这些操作,只需要编辑attributes.adoc文件即可调整属性。

英文:

The PDF theme.yml does not support setting AsciiDoc attributes, so that approach won't work.

However, you can specify attributes on the command-line:

asciidoctor-pdf -a sectnums=all file.adoc

It might be better to create an AsciiDoc file that only defines attributes, say attributes.adoc. You would specify any attributes that you want to use globally:

:sectnums: all
:toc: left

Then, in every document that needs to use those attributes:

= My document
include::attributes.adoc[]

Lorem ipsum...

Once you've done that for all documents, adjusting the attributes requires editing only the attributes.adoc file.

huangapple
  • 本文由 发表于 2023年2月14日 20:52:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/75448121.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定