简体   繁体   中英

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.

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 — eg <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. Eg, you can't use Markdown-style *emphasis* inside an HTML block.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM