riak / riak.github.io

https://riak.github.io/
Apache License 2.0
1 stars 1 forks source link

Multi-language code blocks #81

Open martinsumner opened 2 days ago

martinsumner commented 2 days ago

The multi-language code blocks don't render correctly in the docs at present.

Looking at it, they appear to have been implemented following the standard template using MDX, but the files themselves are plain markdown files.

Just changing the file extension to mdx appears to fix this (i.e. if one renames docs/developing/data-types/counters.md as docs/developing/data-types/counters.mdx), and then the code blocks render as expected:

CounterCodeBlockScreenshot

Obviously the renaming would impact some internal links (i.e. within counters.md to ../maps.md), so there may be a neater way of doing this.

martinsumner commented 1 day ago

It seems that normally docusaurus would treat .md files as mdx, but this can be overridden.

The config does override, presumably this is why the file extension change is necessary.

Changing this may cause problems elsewhere as the MDX parser isn't standards compliant - but at first glance, simply removing the detect setting is all that is required to make all the code blocks work.