mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-28 19:42:37 +02:00
Add a TOC
This commit is contained in:
parent
0f6a153b97
commit
62e8a2c932
4 changed files with 42 additions and 4 deletions
|
@ -27,6 +27,7 @@ FIREFOX_BOOKMARKS_PATH = (
|
||||||
)
|
)
|
||||||
PIWIK_SITE_ID = 3
|
PIWIK_SITE_ID = 3
|
||||||
PLUGIN_PATHS = ["."]
|
PLUGIN_PATHS = ["."]
|
||||||
PLUGINS = [
|
PLUGINS = ["simplereader", ]
|
||||||
"simplereader",
|
|
||||||
]
|
CACHE_OUTPUT_DIRECTORY = "cache"
|
||||||
|
CACHE_DOMAIN = "/cache/"
|
||||||
|
|
|
@ -16,6 +16,10 @@ class SimpleReader(MarkdownReader):
|
||||||
|
|
||||||
def read(self, filename):
|
def read(self, filename):
|
||||||
content, metadata = super(SimpleReader, self).read(filename)
|
content, metadata = super(SimpleReader, self).read(filename)
|
||||||
|
# Add the TOC to the metadata.
|
||||||
|
if len(self._md.toc) > 300:
|
||||||
|
metadata["table_of_contents"] = self._md.toc
|
||||||
|
|
||||||
# Get the title from the first h1
|
# Get the title from the first h1
|
||||||
if "title" not in metadata and len(self._md.toc_tokens):
|
if "title" not in metadata and len(self._md.toc_tokens):
|
||||||
first_title = self._md.toc_tokens[0]
|
first_title = self._md.toc_tokens[0]
|
||||||
|
|
|
@ -38,7 +38,6 @@ td img {
|
||||||
|
|
||||||
ul.articles_list {
|
ul.articles_list {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
padding-left: 10rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.articles_list h2 {
|
ul.articles_list h2 {
|
||||||
|
@ -62,6 +61,15 @@ ul.articles_list li {
|
||||||
font-weight: lighter;
|
font-weight: lighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 600px) {
|
||||||
|
.articles_list .category {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.articles_list .metadata {
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.articles_list .date {
|
.articles_list .date {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
@ -85,3 +93,23 @@ ul.articles_list li {
|
||||||
a.no-color {
|
a.no-color {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#toc_container {
|
||||||
|
background: #f9f9f9 none repeat scroll 0 0;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
display: table;
|
||||||
|
font-size: 95%;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
padding: 20px;
|
||||||
|
width: auto;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#toc_container > ul {
|
||||||
|
font-weight: 700;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#toc_container li, #toc_container ul, #toc_container ul li{
|
||||||
|
list-style: outside none none !important;
|
||||||
|
}
|
|
@ -65,6 +65,11 @@ h1 {
|
||||||
{% if article.headline %}
|
{% if article.headline %}
|
||||||
<h2 class="post-headline">{{ article.headline }}</h2>
|
<h2 class="post-headline">{{ article.headline }}</h2>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if article.table_of_contents %}
|
||||||
|
<div id="toc_container">
|
||||||
|
{{ article.table_of_contents }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<h1>🌟</h1>
|
<h1>🌟</h1>
|
||||||
{{ article.content }}
|
{{ article.content }}
|
||||||
{% if article.image and article.image_link and article.image_author and article.image_license %}
|
{% if article.image and article.image_link and article.image_author and article.image_license %}
|
||||||
|
|
Loading…
Reference in a new issue