Skip to content

Conversation

@gbmor
Copy link

@gbmor gbmor commented Apr 23, 2019

Added a field to the Html struct that holds a map[string]string. HtmlRendererWithParameters() then returns an Html struct with the map initialized. The user may then specify <meta.../> tags to be included in the document header when the document is parsed (and HTML_COMPLETE_PAGE is flagged).

renderer := HtmlRenderer(HTML_COMPLETE_PAGE, "Title", "style.css")
renderer.meta["name=\"author\""] = "foo barrington"
renderer.meta["http-equiv=\"refresh\""] = "1; url=http://localhost"
etc...

With the key being the full attribute of name="..." or http-equiv="...", and value being the unquoted value of the attribute contents="..."

The reason for this was I needed a way to inject <meta.../> tags into a rendered document for one of my projects. I thought, "Doing it after the document is parsed doesn't seem right or efficient, so why not do it during the markdown->html/xhtml translation?".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant