【问题标题】:How to keep list item on same page in asciidoctor-pdf?如何将列表项保留在 asciidoctor-pdf 的同一页面上?
【发布时间】:2019-07-16 19:34:29
【问题描述】:

我正在使用 asciidoc 来整理一些用户文档。我需要以 PDF 结尾;我在 Ubuntu 上使用 asciidoctor-pdf(使用 Asciidoctor 1.5.5 的 Asciidoctor PDF 1.5.0.alpha.18)

我有 asciidoc 项目符号列表;一些列表项是散布有小屏幕截图的文本说明。如果可能,我希望每个列表项都保留在同一页面上。

这些不会让所有内容都在同一页面上:

[options="unbreakable"]
* Use the virtual keyboard to enter the letters and numbers of your network password: +
image:ss/ss_password_done_blurred.png[]

这将所有内容放在同一页面上,但会在整个列表项周围放置一个框:

====
* Use the virtual keyboard to enter the letters and numbers of your network password: +
image:ss/ss_password_done_blurred.png[]
====

有没有办法让普通段落或列表项牢不可破(或保持在一起)?

我需要使用与 asciidoctor-pdf 不同的工具链吗??

【问题讨论】:

    标签: asciidoc asciidoctor asciidoctor-pdf


    【解决方案1】:

    想到的第一个技巧就是从视图中隐藏示例块的边框和背景,只要块样式足以将您的内容保持在一起。比如:

    example:
      border_color: ffffff
      border_radius: 0
      border_width: 0
      background_color: ffffff
      padding: 0
    

    如果您期望更多像这样的需求,Asciidoctor 还提供的 DocBook > PDF 链可能更适合您。在该过程的另一端,您拥有 XSLT,它比基于 Prawn 的 asciidoctor-pdf 配置强大得多。请注意,该路线可能需要对输出进行更多自定义,以使其看起来像 asciidoctor-pdf 那样现代/优雅(IMO,无从属关系)。

    【讨论】:

    • 宾果游戏!把它放到文件'extends-theme.yml'中,在开头添加了extends: default行,然后就做了asciidoctor-pdf -a pdf-style=./extends-theme.yml master.adoc
    猜你喜欢
    • 1970-01-01
    • 2014-10-05
    • 1970-01-01
    • 1970-01-01
    • 2013-01-06
    • 2015-07-06
    • 1970-01-01
    • 2017-11-20
    • 1970-01-01
    相关资源
    最近更新 更多