RMarkdown和Knitr转换为HTML:如何在TOC(目录)中隐藏项目符号? [英] RMarkdown with knitr to HTML: How to hide bullets in TOC (table of contents)?
本文介绍了RMarkdown和Knitr转换为HTML:如何在TOC(目录)中隐藏项目符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在创建的HTML文件中抑制TOC项前面的项目符号?我只想看到标题数字...
How can I suppress the bullet points in front of the TOC items in the created HTML file? I want to see only the headline numbers...
示例 Test.Rmd 文件:
---
title: "Untitled"
author: "Author"
date: "01/25/2015"
output:
html_document:
number_sections: true
toc: yes
toc_depth: 3
---
*Content*
# Headline 1
## Sub headline 1.1
## Sub headline 1.2
### Sub sub headline 1.2.1
# Headline 2
生成的HTML文档的目录将如下所示(带有不需要的项目符号-在此处通过* char指示):
The TOC of the resulting HTML document will look like this (with the unwanted bullet points - here indicated via the * char):
Untitled
Author
01/25/2015
* 1 Headline 1
* 1.1 Sub headline 1.1
* 1.2 Sub headline 1.2
* 1.2.1 Sub sub headline 1.2.1
* 2 Headline 2
...
要点的原因是knitr在默认HTML模板中使用的li标记. 创建的HTML代码如下所示:
The reason for bullet points is the li tag that knitr uses with the default HTML template. The created HTML code looks like this:
<div id="TOC">
<ul>
<li><a href="#headline-1"><span class="toc-section-number">1</span> Headline 1</a><ul>
<li><a href="#sub-headline-1.1"><span class="toc-section-number">1.1</span> Sub headline 1.1</a></li>
<li><a href="#sub-headline-1.2"><span class="toc-section-number">1.2</span> Sub headline 1.2</a><ul>
<li><a href="#sub-sub-headline-1.2.1"><span class="toc-section-number">1.2.1</span> Sub sub headline 1.2.1</a></li>
</ul></li>
</ul></li>
<li><a href="#headline-2"><span class="toc-section-number">2</span> Headline 2</a></li>
</ul>
</div>
我阅读了一些有关 CSS 的内容,以消除要点,但我不知道要解决此问题:
I read a little bit about CSS to suppress bullet points but I have no idea to solve this issue:
查看全文