Could you put {{TOC}} in Metadata?
Hi, I found that in the latest version of MMD,
{{TOC}}
is added. It is a very nice feature. But
currently very cumbersome to be included to support both HTML and
LaTeX. (I mean it is support LaTeX already but I want the native
ToC from LaTeX.)
One way I do it currently is:
<!--
\setcounter{tocdepth}{5}
\tableofcontents
\begin{comment}
-->
**Table of Contents**
{{TOC}}
<!--\end{comment}-->
Such that the HTML will skip the LaTeX command and the LaTeX will skip the TOC generated by mmd.
What I want to suggest is to promote it to a metadata field. (I
am not sure if it can be done already since the documentation
didn't mention.), implemented in a similar way as the base
header level
such that it has variants. In this way I can
activate TOC in HTML only, and use LaTeX Input
to
include the \tableofcontents
. It is also useful in
file transclusion since the transcluded file ignores the metadata,
and hence I won't have repeated metadata in the result.
Another suggestion is to replace {{TOC}}
automatically with \tableofcontents
when converting
into LaTeX. And possibly define {{TOC}}[5] to
mean
\setcounter{tocdepth}{5} \tableofcontents` which can
also be used for HTML output.
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by fletcher on Mar 14, 2015 @ 01:13 PM
Between existing features, there is already the ability to do this -- you can use file transclusion to specify
{{TOC}}
only in certain formats, or the approach that you used above.In general, I don't want to make MMD any more complex than it already is, but rather make use of the current features to implement customizations.
fletcher closed this discussion on Mar 14, 2015 @ 01:13 PM.
Kolen re-opened this discussion on Mar 14, 2015 @ 10:39 PM
2 Posted by Kolen on Mar 14, 2015 @ 10:39 PM
Thanks. The file transclusion feature is a nice suggestion.
However, it doesn't quite work for me. It will turn my .tex file having
\
into\textbackslash
Another problem is I don't understand why when I use
.*
, transclusion to.tex
works fine, but not.html
. Another related question is I don't know what to put in the.html
.This?
But I'm not sure if it will treat it like mmd code or html code...
In general, I find the file transclusion feature intriguing. But the documentation on this is very limited and vague. I think it would be better if, say, it has some example in the mmd gallery.
Support Staff 3 Posted by fletcher on Mar 16, 2015 @ 01:15 PM
File transclusion is very simple -- it replaces {{foo}} with the
contents of the file to create a single MMD document. That's it.
Everything is still treated as MultiMarkdown, it's just divided amongst
multiple files.
F-
Kolen closed this discussion on Mar 02, 2016 @ 02:51 AM.