## #MonthOfJulia Day 36: Markdown

Markdown is a lightweight format specification language developed by John Gruber. Markdown can be converted to HTML, LaTeX or other document formats. You probably knew all that already. The syntax is pretty simple. Check out this useful cheatsheet.

In the latest stable version of Julia support for markdown is provided in the Base package.

Markdown is stored in objects of type Base.Markdown.MD. As you’ll see below, there are at least two ways to construct markdown objects: either directly from a string (using markdown syntax) or programmatically (using a selection of formatting functions).

You’ll find that Base.Markdown.MD objects are rendered with appropriate formatting in your console.

Functions html() and latex() convert Base.Markdown.MD objects into other formats. Another way of rendering markdown elements is with writemime(), where the output is determined by specifying a MIME type.

Markdown has support for section headers, both ordered and unordered lists, tables, code fragments and block quotes.

Most Julia packages come with a README.md markdown file which provides an overview of the package. The readme() function gives you direct access to these files’ contents.

We can also use parse_file() to treat the contents of a file as markdown.

This is rendered below as LaTeX.

And here it is as HTML.

# NaNMath

Implementations of basic math functions which return NaN instead of throwing a DomainError.
Example:

import NaNMath
NaNMath.log(-100) # NaN
NaNMath.pow(-1.5,2.3) # NaN


In addition this package provides functions that aggregate one dimensional arrays and ignore elements that are NaN. The following functions are implemented:


sum
maximum
minimum
mean
var
std

Example:

using NaNMath; nm=NaNMath
nm.sum([1., 2., NaN]) # result: 3.0

What particularly appeals to me about the markdown functionality in Julia is the potential for automated generation of documentation and reports. To see more details of my dalliance with Julia and markdown, visit github.