Markdown Example
Markdown Example
Contents¶
- This is what you can do
This is an example of markdown file created using mdutils python package. In this example you are going to see how to create a markdown file using this library. Moreover, you’re finding the available features which makes easy the creation of this type of files while you are running Python code. An Example R Markdown Thursday, October 5, 2017. This is an R Markdown document. By studying the document source code file, compiling it, and observing the result, side-by-side with the source, you’ll learn a lot about the R Markdown and LaTeX mathematical typesetting language, and you’ll be able to produce nice-looking.
Overview¶
This is an example of markdown file created using mdutils pythonpackage. In this example you are going to see how to create a markdownfile using this library. Moreover, you’re finding the available featureswhich makes easy the creation of this type of files while you arerunning Python code.
Note
Some features available on this library have no effect with the GitHub Markdown CSS. Some of them are:coloring text, centering text…
This is what you can do¶
Create Markdown files¶
Note
create_md_file()
is the last command that has to be called.
Create Headers¶
Using new_header
method you can create headers of different levelsdepending on the style. There are two available styles: ‘atx’ and‘setext’. The first one has til 6 different header levels. Atx’s levels1 and 2 are automatically added to the table of contents unless theparameter add_table_of_contents
is set to ‘n’. The ‘setext’ styleonly has two levelsof headers.
Atx Header 1¶
Atx Header 2¶
Atx Header 3¶
Atx Header 4¶
Atx Header 5¶
Atx Header 6
Setext Header 1¶
Table of Contents¶
If you have defined some headers of level 1 and 2, you can create atable of contents invoking the following command (Normally, the methodwill be called at the end of the code before callingcreate_md_file()
)
Paragraph and Text Format¶
mdutils allows you to create paragraph, line breaks or simply writetext:
New Paragraph Method¶
Using new_paragraph
method you can very easily add a new paragraphon your markdown file. This example of paragraph has been added usingthis method. Moreover, new_paragraph
method make your live easybecause it can give format to the text. Lets see an example:
New Line Method¶
mdutils
has a method which can create new line breaks. Lets see it.
This is an example of line break which has been created withnew_line
method.
As new_paragraph
, new_line
allows users to give format to textusing bold_italics_code
and color
parameters:
This is an inline code which contains bold and italics text and it is centered
How To Use Citation In Markdown Example
Write Method¶
write
method writes text in a markdown file without jump lines'n'
and as new_paragraph
and new_line
, you can give formatto text using the arguments bold_italics_code
, color
andalign
:
The following text has been written with write
method. You can usemarkdown directives to write: bold, italics, inline_code
… oruse the following available parameters:
bold_italics_code
Text color
Create a Table¶
The library implements a method called new_table
that can createtables using a list of strings. This method only needs: the number ofrows and columns that your table must have. Optionally you can align thecontent of the table using the parameter text_align
Items | Descriptions | Data |
---|---|---|
Item 0 | Description Item 0 | 0 |
Item 1 | Description Item 1 | 1 |
Item 2 | Description Item 2 | 2 |
Item 3 | Description Item 3 | 3 |
Item 4 | Description Item 4 | 4 |
Paragraphs are separated by a blank line.
2nd paragraph. Italic, bold, and monospace
. Itemized listslook like:
- this one
- that one
- the other one
Note that --- not considering the asterisk --- the actual textcontent starts at 4-columns in.
Block quotes arewritten like so.
They can span multiple paragraphs,if you like.
Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., 'it's allin chapters 12--14'). Three dots ... will be converted to an ellipsis.Unicode is supported.
An h2 header
Here's a numbered list:
- first item
- second item
- third item
Note again how the actual text starts at 4 columns in (4 charactersfrom the left side). Here's a code sample:
As you probably guessed, indented 4 spaces. By the way, instead ofindenting the block, you can use delimited blocks, if you like:
(which makes copying & pasting easier). You can optionally mark thedelimited block for Pandoc to syntax highlight it:
An h3 header
Now a nested list:
First, get these ingredients:
- carrots
- celery
- lentils
Boil some water.
Dump everything in the pot and followthis algorithm:
Do not bump wooden spoon or it will fall.
Notice again how text always lines up on 4-space indents (includingthat last line which continues item 3 above).
Here's a link to a website, to a localdoc, and to a section heading in the currentdoc. Here's a footnote [^1].
[^1]: Footnote text goes here.
Tables can look like this:
Markdown Example Math
size material color
9 leather brown10 hemp canvas natural11 glass transparent
Table: Shoes, their sizes, and what they're made of
(The above is the caption for the table.) Pandoc also supportsmulti-line tables:
keyword text
red Sunsets, apples, andother red or reddishthings.
green Leaves, grass, frogsand other things it'snot easy being.
A horizontal rule follows.
Here's a definition list:
apples: Good for making applesauce.oranges: Citrus!tomatoes: There's no 'e' in tomatoe.
Again, text is indented 4 spaces. (Put a blank line between eachterm/definition pair to spread things out more.)
Here's a 'line block':
Line one Line too Line tree
and images can be specified like so:
Inline math equations go in like so: $omega = dphi / dt$. Displaymath should get its own line and be put in in double-dollarsigns:
$$I = int rho R^{2} dV$$
And note that you can backslash-escape any punctuation characterswhich you wish to be displayed literally, ex.: `foo`, *bar*, etc.
Markdown Example