1. Include

  • include::ROOT:partial$Header.adoc[]

2. Line Number

asciidoc:
  sourcemap: true
  • antora --asciidoc-sourcemap --fetch antora-playbook.yml

3. Emoji

npm i -g @asciidoctor/core asciidoctor-emoji
asciidoc:
  extensions:
  - asciidoctor-emoji
emoji:bear[5x]

emoji:heart[5x]

4. MathJax

npm i -g @djencks/asciidoctor-mathjax
asciidoc:
  attributes:
    stem: 'asciimath'
  extensions:
  - '@djencks/asciidoctor-mathjax'
****
stem:[\vec{A} * \vec{B} = A_1B_1 + A_2B_2]
****

5. asciidoctor-kroki

  • Asciidoctor使用Kroki转换diagram到图片的extension

  • https://www.npmjs.com/package/asciidoctor-kroki

  • asciidoctor-kroki替代已过时的asciidoctor-plantuml

  • 可使用kroki-fetch-diagram属性在Kroki构建的时间来下载图像,
    即在浏览页面时将不再依赖Kroki,但在Antora中,当前与嵌入式svg图像不兼容

# 用于Asciidoctor
gem install asciidoctor-kroki

asciidoctor -r asciidoctor-kroki fileName.adoc

# 用于Antora
npm i -g asciidoctor asciidoctor-kroki

# docker方式:https://hub.docker.com/r/yuzutech/kroki
# https://docs.kroki.io/kroki/setup/configuration
docker pull yuzutech/kroki:0.22.0
asciidoc:
  extensions:
    - asciidoctor-kroki
  attributes:
    # kroki-server-url: http://192.168.0.123:9500
    kroki-fetch-diagram: true
    kroki-default-format: svg

6. Pdf

gem install text-hyphen

gem install asciidoctor-pdf

asciidoctor-pdf fileName.adoc

asciidoctor -r asciidoctor-pdf fileName.adoc

npm i -g @antora/pdf-extension
  • 在antora-playbook.yaml同级目录创建antora-assembler.yaml

  • 并通过antora-assembler.yaml来指定pdf-theme.yaml和font

  • antora --extension @antora/pdf-extension antora-playbook.yml

  • antora-playbook.yaml

# antora-playbook.yaml

asciidoc:
  attributes:
    source-highlighter: highlight.js
    # module/version/fileName:osp/v0.0.1/osp-adoc.pdf
    attachmentsdir: .
asciidoc:
  attributes:

antora:
  extensions:
  - '@antora/pdf-extension'
  - require: '@antora/lunr-extension'
    index_latest_only: true
    #languages: [en, cn]
📄 antora-assembler.yaml
📄 antora-playbook.yaml
📂 aui-external
  📂 Cjk
    📄 cjk-theme.yml
    📄 NotoSansCJKsc-VF.ttf
    📄 NotoSansMonoCJKsc-VF.ttf
  • antora-assembler.yaml

root_level: 0
component_versions: '*'
asciidoc:
  attributes:
    source-highlighter: highlight.js
    pdf-theme: ./aui-external/Cjk/cjk-theme.yml
  • cjk-theme.yaml

extends: default
font:
  catalog:
    merge: true
    Noto Sans CN: D:/Install/Dev/workspace/AsciiDoc/asciidoc-antora/asciidoc-generator/External/Cjk/NotoSansCJKsc-VF.ttf
    Noto Sans Mono CN: D:/Install/Dev/workspace/AsciiDoc/asciidoc-antora/asciidoc-generator/External/Cjk/NotoSansMonoCJKsc-VF.ttf
  fallbacks:
  - Noto Serif
base:
  text-align: left
  font-family: Noto Sans CN
codespan:
  font-family: Noto Sans Mono CN
kbd:
  font-family: $codespan-font-family
code:
  font-family: $codespan-font-family

7. Lunr Retrieve

  • 各种jieba版本,与node版本不匹配,甚至有从v16到v20的,
    中文无分词效果,中文无分词效果,中文无分词效果,坐等社区维护;

npm i -g @antora/lunr-extension

npm i -g @node-rs/jieba
  • footer-scripts.hbs

{{#if env.SITE_SEARCH_PROVIDER}}
{{> search-scripts}}
{{/if}}
  • header-content.hbs

<div class="navbar-item has-dropdown is-hoverable">
	<div class="navbar-link">
		{{#if env.SITE_SEARCH_PROVIDER}}
	    	<div class="navbar-item search hide-for-print">
	        	<div id="search-field" class="field">
	          		<label for="search-input"></label>
	          		<input id="search-input" type="text"
	          			placeholder="Type To Retrieving..."
	          			{{#if page.home}} autofocus{{/if}} />
	        	</div>
	      	</div>
		{{/if}}
	</div>
</div>
  • antora-playbook.yaml

antora:
  extensions:
  - require: '@antora/lunr-extension'
    index_latest_only: true
    #languages: [en, cn]

8. Tab

npm uninstall asciidoctor@3.0.4 -g

npm uninstall @asciidoctor/core@3.0.4 -g

npm i -g asciidoctor@2.2.7

npm i -g @asciidoctor/core@2.2.7
gem install asciidoctor-tabs

asciidoctor -r asciidoctor-tabs fileName.adoc

npm i -D -g @asciidoctor/tabs

9. Antora Operation

echo off
cls
chcp 65001

set BASE_URL=D:/Install/Antora/AsciiDoc

set ANTORA_URL=%BASE_URL%/asciidoc-generator/
set SITE_URL=%BASE_URL%/asciidoc-distro/docs/index.html

d:
cd %ANTORA_URL%

rem --extension @antora/pdf-extension
rem --extension @antora/lunr-extension

rem -r asciidoctor-pdf
rem -r @djencks/asciidoctor-mathjax

rem --fetch antora-playbook.yml

antora antora-playbook.yml & start %SITE_URL%

10. Antora Github