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

Inserting javascript and css #39

Closed
timvink opened this issue Jul 13, 2020 · 1 comment
Closed

Inserting javascript and css #39

timvink opened this issue Jul 13, 2020 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@timvink
Copy link
Owner

timvink commented Jul 13, 2020

Currently, I do this:

extra_js = """
<script src="https://cdnjs.cloudflare.com/ajax/libs/timeago.js/4.0.0-beta.2/timeago.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/timeago.js/4.0.0-beta.2/timeago.locales.min.js"></script>
<script>
var nodes = document.querySelectorAll('.timeago');
var locale = nodes[0].getAttribute('locale');
timeago.render(nodes, locale);
</script>
"""
idx = output_content.index("</body>")
output_content = output_content[:idx] + extra_js + output_content[idx:]

But this can be done more elegantly config. Two examples in mkdocs plugins I found:

@timvink
Copy link
Owner Author

timvink commented Oct 26, 2020

Released v.0.7.3 that addresses this.

@timvink timvink closed this as completed Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant