Closed quentin closed 1 year ago
Hi, I have a custom language (say foolang) registered in the hljs instance, is it possible to highlight a language that is not listed there: https://github.com/rtfpessoa/diff2html/blob/e5c813949fcbb9a0b96ce528f49539d63cbdcf40/src/ui/js/highlight.js-helpers.ts#L164
foolang
hljs
It is properly detected in the language variable (because the extension of the filename in the diff is .foolang): https://github.com/rtfpessoa/diff2html/blob/e5c813949fcbb9a0b96ce528f49539d63cbdcf40/src/ui/js/diff2html-ui-base.ts#L144-L145
language
.foolang
But this code discards it for 'plaintext' since it is not listed in languagesToExt: https://github.com/rtfpessoa/diff2html/blob/e5c813949fcbb9a0b96ce528f49539d63cbdcf40/src/ui/js/highlight.js-helpers.ts#L653-L655
'plaintext'
languagesToExt
It would be convenient to be able to register custom language/extension mappings.
👋 Thanks for the contribution. Left a comment in the PR.
Hi, I have a custom language (say
foolang
) registered in thehljs
instance, is it possible to highlight a language that is not listed there: https://github.com/rtfpessoa/diff2html/blob/e5c813949fcbb9a0b96ce528f49539d63cbdcf40/src/ui/js/highlight.js-helpers.ts#L164It is properly detected in the
language
variable (because the extension of the filename in the diff is.foolang
): https://github.com/rtfpessoa/diff2html/blob/e5c813949fcbb9a0b96ce528f49539d63cbdcf40/src/ui/js/diff2html-ui-base.ts#L144-L145But this code discards it for
'plaintext'
since it is not listed inlanguagesToExt
: https://github.com/rtfpessoa/diff2html/blob/e5c813949fcbb9a0b96ce528f49539d63cbdcf40/src/ui/js/highlight.js-helpers.ts#L653-L655It would be convenient to be able to register custom language/extension mappings.