jupyter-book / mystmd

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

The discussion area plugin support #1466

Open ValMystletainn opened 2 months ago

ValMystletainn commented 2 months ago

Proposal

Add a comment system support in the html output like that in jupyter book.

Or if it's not necessary in the main project of mystmd, can I build an extension to do so?

Additional notes

Reference

the comments system support of jupyter book

What I have tried

Since adding giscus support is quiet easy from it's doc (Only need to add a script tag below).

<script src="https://giscus.app/client.js"
        data-repo="[ENTER REPO HERE]"
        data-repo-id="[ENTER REPO ID HERE]"
        data-category="[ENTER CATEGORY NAME HERE]"
        data-category-id="[ENTER CATEGORY ID HERE]"
        data-mapping="pathname"
        data-strict="0"
        data-reactions-enabled="1"
        data-emit-metadata="0"
        data-input-position="bottom"
        data-theme="preferred_color_scheme"
        data-lang="en"
        crossorigin="anonymous"
        async>
</script>

I have try to insert it by create an directive mjs extension to insert it. I found there is a node type named html. I think it should keep the original code in the html output. however I failed to get the script above in the output html. And I have change the output of the self-defined directive to raw tag like <img>, <b>123</b>, <video>, <iframe>, <script> (but in simple like <script>console.log(123)</script>) . I get the expected output in <img>, <b>123</b>, but failed again in <video>, <iframe> and simple<script>