Setting a custom theme (atom-one-dark) from @highlightjs doesn't get applied to the code tag element, which disables the custom theme style for the background (I think only the background is affected).
The only workaround is to add this code on the Angular DoCheck hook:
ngDoCheck() {
document.querySelectorAll('code').forEach((block) => {
// will work once when the next line is uncommented
hljs.highlightBlock(block);
});
}
On the sample repo, should be uncommenting the line on app.component.ts
Do you want to request a feature or report a bug?
Bug Report
Setting a custom theme (atom-one-dark) from
@highlightjs
doesn't get applied to thecode
tag element, which disables the custom theme style for the background (I think only the background is affected).Steps to reproduce
npm install
npm start
Inspect using Chrome dev tools shows the code tag not having the hljs class style on the before screenshot
Before
After
What is the expected behavior?
The
code
tag should have thehljs
class applied by default.What is the motivation / use case for changing the behavior?
Properly render any custom theme from highlightjs package and not having to rely on workarounds.
Which version of Angular and Material, and which browser and OS does this issue affect?
Using Chrome on Windows 10. This is my first time trying the component.
Other information
The only workaround is to add this code on the Angular DoCheck hook:
On the sample repo, should be uncommenting the line on
app.component.ts