【问题标题】:Is it possible to use `:toc: left` with JBake?是否可以在 JBake 中使用`:toc: left`?
【发布时间】:2019-06-20 18:50:00
【问题描述】:

我想使用 JBake 渲染 asciidoc 页面,这些页面在左框架中具有浮动 TOC。但是,JBake 似乎只支持将 TOC 放在文件的顶部。

如果我使用具有以下文档标题语法的页面“烘焙”我的网站,则目录位于顶部。

= Software Engineer
John Doe
2019-01-01
:toc: left
:jbake-type: page
:jbake-tags: documentation, manual
:jbake-status: published
...

但是,如果我使用asciidoctor cli 转换同一个文件,则目录会按预期呈现在左侧。这是 JBake 的限制,还是我做错了什么?

【问题讨论】:

    标签: asciidoctor jbake


    【解决方案1】:

    :toc: left 不是嵌入式 asciidoc 的有效选项。有关详细信息,请参阅 [1]。

    但是,仍有希望,因为您可以更改样式表。 首先,更改您的模板,以便将类 "toc2 toc-left" 添加到 body 标记中。这为左侧的目录腾出了空间。

    然后将 toc2-styles 从原始 aciidoctor 样式表复制到 toc-style,方法是将其复制并 psting 到标题中:

          <style>
          @media only screen and (min-width:768px){
              #toctitle{font-size:1.375em}
              #toc.toc{margin-top:0!important;background-color:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #efefed;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto; padding-top: 60px;}
              #toc.toc #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em}
              #toc.toc>ul{font-size:.9em;margin-bottom:0}
              #toc.toc ul ul{margin-left:0;padding-left:1em}
              #toc.toc ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}
          }
          @media only screen and (min-width:1280px){
              body.toc2{padding-left:20em;padding-right:0}
              #toc.toc{width:20em; padding-top: 60px;}
              #toc.toc #toctitle{font-size:1.375em}
              #toc.toc>ul{font-size:.95em}
              #toc.toc ul ul{padding-left:1.25em}
          }
          </style>
    

    这应该可以解决您的问题。

    [1]https://asciidoctor.org/docs/user-manual/#using-a-toc-with-embeddable-html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-18
      • 2015-04-14
      • 1970-01-01
      • 1970-01-01
      • 2017-12-18
      • 2013-06-02
      相关资源
      最近更新 更多