John Sebastian

Fluid Mechanics; Applied Mathematics; Soft matter; Biophysics

Some of the handy Markdown tricks I’ve come across and found useful, and collected for reference.




1 To change fonts inline in Markdown

<p class=text-center style="font-family: Georgia, serif; font-size:11pt; font-weight:bold">
 This is how you do it!
</p>

Check the full HTML output to see how it works. Themes can override the intended output.

General styling tweaks are discussed in Section: Text formatting and Styles

1.1 Useful list of Fonts

As you can see, this is not the most elegant solution for inline changes in text formatting. If it were so, I would have converted each of the above list entries to the fonts they represent.

2 Toc - Table of Contents

2.1 Indentation

<script>
$(document).ready(function() {
  $items = $('div#TOC li');
  $items.each(function(idx) {
    num_ul = $(this).parentsUntil('#TOC').length;
    $(this).css({'text-indent': num_ul * 10, 'padding-left': 0});
  });

});
</script>

2.2 TOC anywhere on the page

3 Text alignment

<div class=text-justify>
body
</div>

4 Text formatting and Styles

<style type="text/css">

body{ /* Normal  */
      font-size: 12px;
  }
td {  /* Table  */
  font-size: 8px;
}
h1.title {
  font-size: 38px;
  color: DarkRed;
}
h1 { /* Header 1 */
  font-size: 28px;
  color: DarkBlue;
}
h2 { /* Header 2 */
    font-size: 22px;
  color: DarkBlue;
}
h3 { /* Header 3 */
  font-size: 18px;
  font-family: "Times New Roman", Times, serif;
  color: DarkBlue;
}

</style>

4.1 Themes

The list of themes available to call from the header via theme is available at Bootswatch1

I have used an implicit link in section To change fonts inline in Markdown.

The syntax is to use the correct heading you want to link to within square brackets:

I have used an implicit link in section [To change fonts inline in Markdown].

6 Footnotes

The syntax is as follows. Scroll down to see how they appear.

Footnote 1 link[^first].

Footnote 2 link[^second].

Inline footnote^[Text of inline footnote] definition.

Duplicated footnote reference[^second].

[^first]: Footnote **can have markup**

    and multiple paragraphs.

[^second]: Footnote text.

7 Converting to GFM

The front matter specifics:

output:
  md_document:
    variant: gfm
    toc: yes
    toc_depth: 5
    number_sections: true
preserve_yaml: true

8 Reference

  1. markdown-it
  2. R Markdown: The Definitive Guide
  3. Reproducible Templates for Analysis and Dissemination Course by Emory University
  4. Table of Contents Shortcode

interview](https://www.youtube.com/watch?v=NkbY2RHviPU&ab_channel=TeawithTeachers)\

Catalogue](https://bookdown.org/yihui/rmarkdown/html-document.html#appearance-and-style)

  1. [Rmarkdown