OpenStax-CNX module: m50417 1

Markdown text formatting*

Hannes Hirzel

This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 4.0„

Abstract is an an easy-to-read, easy-to-write format which may be converted into struc- turally valid XHTML and other formats.

1 Introduction Markdown is a way of marking text les for formatting. It works with plain text les as produced with the Microsoft notepad or similar programs. It is easy-to-read and easy-to-write and may be converted into structurally valid XHTML and other formats. One of many command line tools to convert text from markdown to other formats is pandoc. Writing texts with Markdown may be used in emails. The texts written this way then may be posted into a content management system like Wordpress. Wordpress has a setting1 which makes it accept Markdown as input. This gives an easy way for maintaining a documentation. The rst section shows the elements which are used in the module Creating a XHTML le with notepad++2 . The second section covers some additional elements.

2 Markdown formatting for basic HTML Some basic elements are titles, numbered and unnumbered lists, links to web pages and insertion of pictures. Titles

Main title ======

Subtitle ------

Main titles are underlined with equal signs, subtitles with dashes. Numbered lists

*Version 1.13: Dec 10, 2016 2:42 am -0600 „http://creativecommons.org/licenses/by/4.0/ 1http://legacy.cnx.org/content/m57747/latest/ 2https://legacy.cnx.org/content/m45584/latest/

http://cnx.org/content/m50417/1.13/ OpenStax-CNX module: m50417 2

1. Choose start menu 2. Type in **Regional** 3. Choose **Regional Settings** 4. Choose **Keyboard layouts** tab in dialog box

Pictures To insert pictures type an exclamation mark, followed by square . Place the caption text (=the text which appears below the picture) within the square brackets. Then follow with regular brackets (no space) and include the le name of the picture. Markdown code for inserting pictures

![Regional settings dialog box](regionalSettings.png)

3 Example The example le from module Creating a XHTML le with notepad++3 looks like this in markdown. It contains a main title (h1 in HTML), two subtitles (h2 in HTML), paragraphs, bold and italic text. Markdown example De finibus bonorum et malorum ======

Sed ut perspiciatis ------

Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo.

Qui dolorem ipsum, quia *dolor sit amet*, consectetuer adipiscing velit, sed quia non numquam [do] eius modi tempora inci[di]dunt, ut labore et dolore magnam aliqum quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationenem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?

At vero ------

At vero eos et accusamus et **iusto** odio dignissimos ducimus, qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias excepturi sint, obcaecati cupiditate non provident, similique sunt in culpa, qui officia deserunt mollitia animi, id est laborum et dolorum fuga.

3http://cnx.org/content/m45584/latest/

http://cnx.org/content/m50417/1.13/ OpenStax-CNX module: m50417 3

3.1 Document conversion To convert a markdown document to with the pandoc4 (a command line tool5 ) use the following command pandoc --from markdown --to html --standalone myFile.md --output=myFile.html Alternatively use an on-line converter, see References section.

4 Additional markdown elements Markdown code for a table Table test ======

| | | |------|------| | | | |Lesson 1 |Vowels | | | | |Lesson 2 |Consonants | | | | |Lesson 3 |Word initial nasals | | | | |Lesson 4 |Word final nasals |

Hyperlinks Hyperlinks are coded as follows: The text which appears as the link in square brackets.This is followed by the URL in parenthesis. Code for a hyperlink [Connections](http://www.cnx.org) Images are inserted like hyperlinks but have an exclamation in front. Code for images ![the caption of the image](imageFileName.jpg)

5 References Specication6 of the Markdown format. Wikipedia entry7 on Markdown There are many on-line editors for markdown available. For example http://dillinger.io/8 or http://johnmacfarlane.net/pandoc/try/9 . The pandoc10 tool serves to convert Markdown from and to many other text formats.

4http://johnmacfarlane.net/pandoc/README.html 5http://cnx.org/content/m50410/latest/ 6http://spec.commonmark.org/ 7http://en.wikipedia.org/wiki/Markdown 8http://dillinger.io/ 9http://johnmacfarlane.net/pandoc/try/ 10http://johnmacfarlane.net/pandoc/

http://cnx.org/content/m50417/1.13/ OpenStax-CNX module: m50417 4

See also http://mashable.com/2013/06/24/markdown-tools/11 Asciidoc Similar approach is Asciidoc12 , a toolchain here13 . The le extension is adoc on github. Examples showing e-book creation14 . Side by side comparison of Markdown and Asciidoc of basic formatting15 . With pandoc16 conversion from and to Markdown is possible.

11http://mashable.com/2013/06/24/markdown-tools/ 12http://asciidoc.org/ 13http://asciidoctor.org/ 14http://www.methods.co.nz/asciidoc/publishing-ebooks-with-asciidoc.html 15https://github.com/awestruct/web-editor/issues/12#issuecomment-19943154 16http://pandoc.org/

http://cnx.org/content/m50417/1.13/