我正在使用asciidoctor生成html。我有以下清单:
. one
. two
. three
image::mypic.png[]
. four
Run Code Online (Sandbox Code Playgroud)
并且当转换为html时,它看起来像这样:
1. one
2. two
3. three
<my picture>
1. four
Run Code Online (Sandbox Code Playgroud)
在html中,我希望看到:
1. one
2. two
3. three
<my picture>
4. four
Run Code Online (Sandbox Code Playgroud)
我不想在插入图像后手动重置计数器,因为我有数百种类似的情况。
编辑:由于我的问题似乎特定于我的设置,我在这里提供了一个完整的最小工作示例。
这是我的 Maven 设置 ( pom.xml):
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.0-SNAPSHOT</version>
<name>AsciiDoc Test</name>
<build>
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.3</version>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-pdf</artifactId>
<version>1.5.0-alpha.11</version>
</dependency>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>1.5.4</version>
</dependency>
<!-- beware, jruby 1.7.23 breaks asciidoctorj -->
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>1.7.21</version>
</dependency>
</dependencies>
<configuration>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
</configuration>
<executions>
<execution>
<id>generate-pdf-doc</id>
<phase>generate-resources</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>pdf</backend>
<doctype>book</doctype>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
这是我的 AsciiDoc 源代码 ( src/test.adoc):
[cols="a"]
|===
|First paragraph
second …Run Code Online (Sandbox Code Playgroud) 默认情况下,asciidoctor创建一个静态toc.这是非常酷的但是对于长文档来说,如果toc可以更紧凑并且会突出显示读者当前文档中的位置,那将是很好的.
在这一点上,tocify进来了.Tocify是一个很好的Javascript解决方案,正是为了解决这个问题.
现在的问题是:如何使用asciidoctor进行tocify?
Asciidoctor 问题699与此相关.
javascript jquery tableofcontents asciidoctor jquery-tocify-js
我非常喜欢asciidoctor的标注,请参阅http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/,并在"带标注的代码块"页面中搜索,点击"查看结果".但我使用Ipython笔记本进行书写,而Markdown则是选择.(通过"原始NBconvert"在Ipython笔记本中尝试Asciidoctor,结果很混乱.)似乎我只需要来自Asciidoctor的源代码标注.所以我的问题是如何从Markdown获得类似的结果?
如何在asciidoc/asciidoctor中定义宏?
我将在文档的许多部分使用重复模式,因此我想进行参数化替换以避免多次输入相同的内容.
特别是,我有以下asciidoc片段:
{set:cellbgcolor:grey}
[grid=none, frame=none]
|===
| X >| Y
|===
{set:cellbgcolor!}
Run Code Online (Sandbox Code Playgroud)
我需要将它放在文档的几个部分中,用不同的文本替换来代替X和Y.我该如何实现?
我有使用AsciiDoc的用户指南它很漂亮,尽管我没有花太多时间.
AsciiDoc插件很棒.所以我想在用户指南中传递我的Maven最终名称.
问题:怎么做?
<finalName>${project.artifactId}-${project.version}-${version.state}-r${buildNumber}</finalName>
Run Code Online (Sandbox Code Playgroud)
我的asciidoctor-maven-plugin配置是:
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${asciidoctor.maven.plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-pdf</artifactId>
<version>${asciidoctorj.pdf.version}</version>
</dependency>
<!-- Comment this section to use the default jruby artifact provided by the plugin -->
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>${jruby.version}</version>
</dependency>
<!-- Comment this section to use the default AsciidoctorJ artifact provided by the plugin -->
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>${asciidoctorj.version}</version>
</dependency>
</dependencies>
<configuration>
<sourceDirectory>src/docs/asciidoc</sourceDirectory>
<sourceDocumentName>manual.adoc</sourceDocumentName>
<!-- Attributes common to all output formats -->
<attributes>
<sourcedir>${project.build.sourceDirectory}</sourcedir>
</attributes>
</configuration>
<executions>
<execution>
<id>generate-pdf-doc</id>
<phase>generate-resources</phase>
<goals>
<goal>process-asciidoc</goal> …Run Code Online (Sandbox Code Playgroud) 我正在使用 asciidoc 和 asciidoctor 编写文档。所以,我有一个 intro.adoc 文件,然后是一堆节文件。因此,我想要做的是将它们列出到 intro.adoc 并向它们添加超链接,以便于导航。
为此我可以想到两种方法:
首先,我可以使用标头并将相对链接关联到同一目录中的 .adoc 文件。这样,他们就会重定向到他们。但我不知道如何实现它。link: == section1.adoc[Section 1]不管用。
其次,使用include::section1.adoc[]. 它可以工作,但不是超链接。
这有什么问题吗?或者有一个简单的方法可以做到这一点。
如果不清楚,我正在尝试# [Section1](section.md)在 asciidoc 中实现这一点(Markdown 版本)。
在降价我可以写:
[example1][myid]
[example2][myid]
[myid]: http://example.com
Run Code Online (Sandbox Code Playgroud)
所以我不必多次重新输入完整的外部链接。
AsciiDoc 中是否有类似的功能?对 Asciidoctor 实现特别感兴趣。
到目前为止,我只能找到:
<<>>:myid:,但我再也找不到了。但是我没有看到如何为每个链接使用不同的文本。我想在表格中突出显示我的一些代码。我尝试了很多方法但我可以解决它。
如果有人能帮助我,我将不胜感激。
例如,让某个类中有一个 Java 常量
public class MyClass{
public static final String ENDPOINT="http://example.com"
}
Run Code Online (Sandbox Code Playgroud)
让我们尝试在 AsciiDoctor 中描述该类(公司文档原因)
==== My class
..... some descripton .....
It is exposed trough http://example.com
Run Code Online (Sandbox Code Playgroud)
现在,每次更改端点时,我也必须手动更新文档(IDE 查找和替换显然可以解决问题)。有没有办法将 Java 常量包含到 AsciiDoc 中,这样我就不必将其值复制到文档中?
我很乐意看到类似的东西{import my.package.MyClass#ENDPOINT}。
asciidoctor ×10
asciidoc ×9
java ×2
maven ×2
ascii ×1
ascii-art ×1
callouts ×1
javascript ×1
jquery ×1
markdown ×1