Switch to unified view

a b/docs/assets/overrides/partials/comments.html
1
{% if page.url.split("/")[0] in ["concepts", "tutorials", "pipes", "tokenizers", "data", "utilities"] %}
2
<script src="https://giscus.app/client.js"
3
        data-repo="aphp/edsnlp"
4
        data-repo-id="R_kgDOG97JnA"
5
        data-category="Announcements"
6
        loading="lazy"
7
        data-category-id="DIC_kwDOG97JnM4CkS1h"
8
        data-mapping="title"
9
        data-strict="0"
10
        data-reactions-enabled="1"
11
        data-emit-metadata="0"
12
        data-input-position="bottom"
13
        data-theme="https://aphp.github.io/edsnlp/master/assets/stylesheets/giscus_light.css"
14
        data-lang="en"
15
        crossorigin="anonymous"
16
        async>
17
</script>
18
19
<!-- Synchronize Giscus theme with palette -->
20
<script>
21
    var giscus = document.querySelector("script[src*=giscus]")
22
23
    // Set palette on initial load
24
    var palette = __md_get("__palette")
25
    if (palette && typeof palette.color === "object") {
26
        var theme = palette.color.scheme === "slate"
27
            ? "https://aphp.github.io/edsnlp/master/assets/stylesheets/giscus_dark.css"
28
            : "https://aphp.github.io/edsnlp/master/assets/stylesheets/giscus_light.css"
29
30
        // Instruct Giscus to set theme
31
        giscus.setAttribute("data-theme", theme)
32
    }
33
34
    // Register event handlers after documented loaded
35
    document.addEventListener("DOMContentLoaded", function () {
36
        var ref = document.querySelector("[data-md-component=palette]")
37
        ref.addEventListener("change", function () {
38
            var palette = __md_get("__palette")
39
            if (palette && typeof palette.color === "object") {
40
                var theme = palette.color.scheme === "slate"
41
                    ? "https://aphp.github.io/edsnlp/master/assets/stylesheets/giscus_dark.css"
42
                    : "https://aphp.github.io/edsnlp/master/assets/stylesheets/giscus_light.css"
43
44
                // Instruct Giscus to change theme
45
                var frame = document.querySelector(".giscus-frame")
46
                frame.contentWindow.postMessage(
47
                    {giscus: {setConfig: {theme}}},
48
                    "https://giscus.app"
49
                )
50
            }
51
        })
52
    })
53
</script>
54
{% endif %}