Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use static html in mkdocs

Is there a solution to use HTML in markdown files - or an option to display a whole extra page that is pure HTML?

Problem: I want to include an html snippet in my mkdocs generated wiki that uses some inline Javascript.

Tried: I have been searching for a few hours now and could not find an answer here or in the official docs.

like image 435
Will Occam Avatar asked Nov 07 '17 18:11

Will Occam


1 Answers

Simply include the HTML in your Markdown document. MkDocs does not document this because this is standard Markdown behavior. In fact, the Markdown rules state:

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

The only restrictions are that block-level HTML elements — e.g. <div>, <table>, <pre>, <p>, etc. — must be separated from surrounding content by blank lines, and the start and end tags of the block should not be indented with tabs or spaces. Markdown is smart enough not to add extra (unwanted) <p> tags around HTML block-level tags.

...

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

like image 130
Waylan Avatar answered Oct 04 '22 19:10

Waylan