Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow writing of user-specified <meta.../> tags to document header #541

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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