toggle code
Benoit Barthelet <[email protected]>
| Newsgroups | gmane.text.docutils.user |
|---|---|
| Message-ID | <CAM0ORj=UQaqCzhKWqCwxR2aEgXL7SGuVe3Ob1DqmJtT8RXAOUw@mail.gmail.com> |
Hello, I'm finding myself writing in rst and pasting long parts of code using the .. code:: directive I'd like to be able to have togglable code when using rst2html. If I'm correct I can achieve that with or without javascript, in both case I seem to be missing one part of the puzzle to make it work effortlessly. With javascript, as described in https://stackoverflow.com/a/25543713/3581357 I can create a container and have the js code handle the toggle, this works fine for me, except that I'm unable to find a way to add the js code in question to the rst2html cli. I see there is a --script flag but only for rst2html5. Without javascript it seems like css can be used to get the toggle effect as described here: https://siongui.github.io/2017/02/27/css-only-toggle-dom-element/ That solution would be quite elegant, ids could be changed to classes and the css modified accordingly, but I don't see a way to add a <input id="element-toggle" type="checkbox" /> which this solution is ultimately based on. Is it where I should write my own directive as described here http://docutils.sourceforge.net/docs/howto/rst-directives.html ? thanks for your pointers for a beginner rst writer -- benoit barthelet http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot