Broken MDX components on download

This is related to Exclude single line on markdown headers

When I upload an MDX, on download some components returned broken. See the diff image:

Basically and for some reason it breaks a string, breaking all the component. I suspect that is not the same string on all files, I guess there are other “breaking points”.

I tried to create an script that add a # at the begining of the line, which break the component anyway, and I tried to comment the component before upload using [//]: # which don’t return the component on download.

Any suggestions?

1 Like

It’s a Docusarus MDX, right? Probably refer to this articles in order to fix it:

The last one has described some well-known MDX issues.

1 Like

My workaround finally was do some pre/post scripts:

# After swagger generation script (add \`\`\`\`mdx-code-block arround JSX )

find docs/api/ -type f -name '*.mdx' -exec sed -i -e '/^\(<\)/i\`\`\`\`mdx-code-block' -e '/^\(<\)/a\`\`\`\`' {} \; 

# Before upload script (comment with # api: on mdx headers)

find docs/api/ -type f -name '*.mdx' -exec sed -i -e 's/\(^api:\)/#\1/g' {} \; | grep api:

# After upload script  (uncomment with #api: on mdx headers)

find docs/api/ -type f -name '*.mdx' -exec sed -i -e '/#api:/ s/^#//' {} \; 

# After download script  (uncomment with #api: on mdx headers)

find i18n/**/**/docusaurus-plugin-content-docs/current/api/ -type f -name '*.mdx' -exec sed -i -e '/#api:/ s/^#//' {} \;
2 Likes

Great workaround! you must be an experience developer :slight_smile: Probably if there will be more community-developed tools\scripts\integrations in the future, Crowdin team will develop some kind of community apps store.

2 Likes