Skip to content

Commit 78ce236

Browse files
authored
Merge pull request #132 from docsbydoxdox/hotfix/code-highlighting-pdf
[hotfix] Forced code highlighting to javascript in pdf renderer.
2 parents e3e6e92 + 48a5e98 commit 78ce236

File tree

1 file changed

+4
-9
lines changed
  • packages/doxdox-renderer-pdf/src

1 file changed

+4
-9
lines changed

packages/doxdox-renderer-pdf/src/index.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,10 @@ import { Doc, File, Method } from 'doxdox-core';
1111
const md = new MarkdownIt({
1212
html: true,
1313
linkify: true,
14-
highlight: function (str, lang) {
15-
if (lang && hljs.getLanguage(lang)) {
16-
try {
17-
return hljs.highlight(str, { language: lang }).value;
18-
} catch (_) {}
19-
}
20-
21-
return '';
22-
}
14+
highlight: str =>
15+
`<div class="bg-light p-3">${
16+
hljs.highlight(str, { language: 'javascript' }).value
17+
}</div>`
2318
});
2419

2520
const renderMethod = (method: Method) => `<div class="mb-5"><a name="${

0 commit comments

Comments
 (0)