YAML front matter in Typora

    I was looking for ways to add a cover page, header, and footer in Markdown and just figured out how we do it in Typora Markdown editor. It is easy. Set the header and footer using YAML Front Matter.

The YAML front matter must be the first thing in the file and must be valid YAML, set between triple-dashed lines. 

Source: https://support.typora.io/

The following is an example for setting the document title, header, and footer using YAML:

---

title: Agile Technical Documentation

header: A Quick Guide for Agile Technical Documentation

footer: ${pageNo}

---

Apart from this, you need to make a few PDF export settings.

Select File > Preferences > Export > PDF and select the checkbox for Read and overwrite export settings from YAMAL front matters.

Now, the document exported into PDF will have A Quick Guide for Agile Technical Documentation in its header and page number in its footer.

If you need a cover page as well for the PDF export, paste the following content in the Append Extra Content (HTML) field:

<meta name="title" content="${title}"> <div id='_export_cover' style="height:100vh;"> <div id='_export_title' style="margin-top: 25%;text-align: center;font-size: 3rem;"> </div> </div> <script> var $cover = document.querySelector("#_export_cover"); var title = document.querySelector("meta[name='title']").getAttribute("content"); if(!title || title == "${title}") { // no title $cover.remove(); } else { document.body.insertBefore($cover, document.body.childNodes[0]) $cover.querySelector("#_export_title").textContent = title; } </script>

The document exported to PDF will have a cover page with Agile Technical Documentation in its title.
For more information, see:
The ability to learn is the key to survival. We can learn faster by learning from each other.

Comments

Popular posts from this blog

Technical Writing essentials

Apply Goldilocks principle