jupyter-book / mystmd

Command line tools for working with MyST Markdown.
https://mystmd.org/guide
MIT License
219 stars 64 forks source link

Support javascript/CSS extensions in the HTML export #1571

Closed nthiery closed 3 days ago

nthiery commented 1 month ago

JupyterBook/sphinx makes it easy to extend the HTML export by providing javascript and CSS files that should be loaded in the HTML files: if a javascript file foo.js is dropped in the _static directory, then it's automatically added to the export directory, and a <script> tag is added all generated html files to load it. Same for a CSS file.

Proposal

  1. Provide any equivalent mechanism.
  2. (bonus) provide the exact same mechanism to easy transition.

Use case

In my course notes, I am using a custom js/css extension that adds two sliders in the top bar to choose whether to display solutions and/or instructor notes which is much more convenient than having separate versions of the documents.

Being able to quickly hack such extensions empowers users to explore features they would want to have, until they become official features.

@choldgraf: maybe this issue could be added to #189?

choldgraf commented 1 month ago

Do you think this is a duplicate of these two issues @nthiery ?

nthiery commented 1 month ago

Oh, yes; thanks @choldgraf ! And I had even commented on those. Apparently I have a very short memory, and I failed my searches before creating a new issue :-) Sorry for the noise.

This issue can be closed, up maybe to a tiny action: mentioning in the above issues, and as source of inspiration, the sphinx approach of simply throwing the css/js files in _static.

choldgraf commented 3 days ago

Closing for: