Skip to content

Commit 575833b

Browse files
authored
fix: Inline code in comments should look fine now (#380)
* fix: Inline code in comments should look fine now
1 parent c78b736 commit 575833b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lms/static/comments.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,18 @@ function configureMarkdownParser() {
231231
code: (code, infoString, _) => {
232232
const language = infoString || 'plaintext';
233233
return `<pre><code class="language-${language}">${code}</code></pre>`;
234-
}
234+
},
235+
codespan: (code) => {
236+
const parsed = (
237+
code
238+
.replace(/&quot;/g, '"')
239+
.replace(/&#39;/g, "'")
240+
.replace(/&lt;/g, '<')
241+
.replace(/&gt;/g, '>')
242+
.replace(/&amp;/g, '&')
243+
);
244+
return `<code>${parsed}</code>`;
245+
},
235246
},
236247
});
237248
}

0 commit comments

Comments
 (0)