diff --git a/src/translator.js b/src/translator.js index c9745992..2e07f056 100644 --- a/src/translator.js +++ b/src/translator.js @@ -116,6 +116,13 @@ function getPostContent(postData, turndownService, config) { //
 block, save it to a data attribute so the "pre" rule can use it
 	content = content.replace(/(\r?\n
+	const codeRegex = /\[code(\s+language\s*=\s*"(?[^"]+)")?.*?\](?.+?)\[\/code\]/gs;
+	content = content.replace(codeRegex, (match, _, lang, src) => {
+		const language = lang || 'none';
+		return `
${src.trim()}
`; + }); + // use turndown to convert HTML to Markdown content = turndownService.turndown(content);