Exclude single line on markdown headers

Hi all,

I’m using docusaurus plugin to generate documentation from a swagger file: GitHub - PaloAltoNetworks/docusaurus-openapi-docs: 🦝 OpenAPI plugin for generating API reference docs in Docusaurus v2. .

This generator adds to the MDX files a header which contain a json string used on the react components, something like:

---
// MDX header
api: {"description":"Get account information by its address or public key ... // long json string
---

This, on my crowdin editor is parsed and converted to some kind of broken array of elements like:

api: 
   0:  description":"Get account information by its address or public key
// And a long list of broken items for each JSON element

Also I can’t select this line to hide it on the editor.

Then, after download translations, my Docusaurus is broken.

I would like to, or:

  • Ignore the api: line for this specific folder
  • Or configure the crowdin to don’t parse this json, maybe doing something with markdown segmentation but is outside my knowledge

Could you recommend me a way to fix this?

Thanks!

Try just hiding those stings in the Crowdin. Open editor, use some filter by context \ maybe labels if you have, maybe something else. Enter the side by side view, select all and bulk hide. The best solution for now.

I’ve been in contact with one member of Crowdin’s team, they say that global MD/MDX improvement will be release not earlier than end of the winter.

Well,

Few things: I tried an script that comment the line on upload and uncomment on download, works well for this error.

In other hand, your suggested fix can’t work because this line is on the header of the mdx and for some reason I can’t find it. I’m going to content > strings and search api:. This return nothing. Anyway, I have tens of files to “ignore” this line, this is lot of work to do by hand…

And finally, seem that is not the only thing that crowdin breaks! See Broken MDX components on download .

Probably MDX files can’t be handled with 100% accuracy due to specific structure, especially with docusarus. It’s now a simple .jsons, they’re complex files. I guess you’ll need to figure a workaround because there for sure wouldn’t be a quick solution out of the box.

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