Head block extraction lets Markdown authors add css, script and other content to the HTML
head block of the main page.
Normally when using Markdown as a way to author static web pages, the translated markdown is simply rendered into the middle of an outer page template. This is exactly how Jab's static pages work.
In a couple of the pages on toptensoftware.com however I needed to insert script and css references into the page's head block. (eg: the MarkdownDeep Demo Page).
What I needed was a way to declare
<head> content in my markdown that could be extracted and made available to the template that rendered the outer framework of each page.
MarkdownDeep provides this capability via two new properties:
- Set to true to enable head block extraction
- After translating a markdown document, this property will hold the content of any embedded head blocks.
So, say you have a markdown document like this:
If you set
ExtractHeadBlock to true after translating the markdown the HeadBlockContent property will contain this:
ie: exactly what needs to be inserted into the final page's head block.
<head> tags themselves have already been removed).