build: fix crowdin build for admonition syntax

This commit is contained in:
Erick Zhao 2022-02-14 23:43:39 -08:00
Родитель 5efd4d770d
Коммит adf029c3cb
1 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -93,6 +93,18 @@ const newLineOnHTMLComment = (line) => {
return line;
};
/**
* Crowdin translations also happen to break
* Docusaurus' MDX admonition syntax.
* @param {string} line
*/
const newLineOnAdmonition = (line) => {
if (line.endsWith(':::') && !line.startsWith(':::')) {
return line.replace(':::', ':::\n');
}
return line;
};
/**
* Applies any transformation that can be executed line by line on
* the document to make sure it is ready to be consumed by
@ -108,6 +120,7 @@ const transform = (doc) => {
apiTransformer,
fiddleTransformer,
newLineOnHTMLComment,
newLineOnAdmonition,
];
for (const line of lines) {