html - 如何使用 rst2html 创建适当的标题级别
问题描述
我不明白为什么:
H1: document title
##################
Sample H2
*********
Sample content.
结果是:
<div class="document" id="h1-document-title">
<h1 class="title">H1: document title</h1>
<h2 class="subtitle" id="sample-h2">Sample H2</h2>
<p>Sample content.</p>
</div>
然而
H1: document title
##################
Sample H2
*********
Sample content.
Sample H3
*********
Sample content.
结果是:
<div class="document" id="h1-document-title">
<h1 class="title">H1: document title</h1>
<div class="section" id="sample-h2">
<h1>Sample H2</h1>
<p>Sample content.</p>
</div>
<div class="section" id="sample-h3">
<h1>Sample H3</h1>
<p>Sample content.</p>
</div>
即我不能有一个h1 元素后跟一个以上的h2。谢谢。
解决方案
这是关于文档标题和副标题的解释。如果第一个标题的修饰在文档中是唯一的,则将其解释为文档标题。如果在第一个标题之后紧接着有另一个带有独特装饰的第二个标题,则将其视为副标题。
请参阅http://docutils.sourceforge.net/docs/user/rst/quickstart.html#document-title-subtitle。
例子:
Document title
##############
Subtitle
.........
Heading 1
*********
Sample content.
Heading 2
---------
Sample content.
Heading 3
---------
Sample content.
通过这个标记,rst2html 将生成带有如下标题的 HTML:
- 文件标题:(
<h1>
居中) - 副标题:(
<h2>
居中) - 标题 1:
<h1>
- 标题 2:
<h2>
- 标题 3:
<h2>
推荐阅读
- python - 在运行 ubuntu 的 mac(host) 上使用 docker 构建 tensorflow 时出现 GCC 编译错误
- css - 如何在css中更改特定网站的背景颜色?
- apache - 如何修复 Apache 2.4 启动时要求此处不允许
- service - 如何在 solaris 11 崩溃后自动重启服务?
- python - 覆盖 get_queryset 方法后,Django 管理列表页面需要永远加载
- java - 如何将 java 类类型转换为其基类型?
- python - 无法在 python kivy 音频中打开混音器
- sql - 使用前一行计算/条件的 Oracle SQL 滞后函数
- javascript - 在 html 表中呈现 JSON 树对象
- java - ResourceAccessException:POST 请求的 I/O 错误