hiroppy / fusuma

✍️ Fusuma makes slides with Markdown easily.
https://hiroppy.github.io/fusuma
5.4k stars 194 forks source link

Code "lang", which is part of a list, is not considered #625

Open szotsaki opened 2 years ago

szotsaki commented 2 years ago

Type

When we have a list and inside it a Prism.js code section (```) fusuma doesn't add its language to the loadable list of languages.

Here is an example:

# Header

* First line
* Second line
    ```
    Code without language
    ```
    ```diff
    --- file1.txt   2018-01-11 10:39:38.237464052 +0000
    +++ file2.txt   2018-01-11 10:40:00.323423021 +0000
    @@ -1,4 +1,4 @@
    cat
    -mv
    -comm
    cp
    +diff
    +comm
    ```
* Third line
    * Fourth line
        ```diff
        --- file1.txt   2018-01-11 10:39:38.237464052 +0000
        +++ file2.txt   2018-01-11 10:40:00.323423021 +0000
        @@ -1,4 +1,4 @@
        cat
        -mv
        -comm
        cp
        +diff
        +comm
        ```

This is valid markdown where code sections are indented to the list level. Rendered by github:

The problem is that diff is not syntax coloured on the slide (but it is here above).

The reason is in mdx-loader/src/mdxPlugin.js tree.children.forEach() only processes top-most code types but doesn't descent deeper (e.g. into a list type).