Closed zmadel closed 4 years ago
Hi @zmadel,
This is documented in the README.md: https://github.com/jfcere/ngx-markdown#syntax-highlight
The example in the documentation shows how to add those files to scripts
section of angular.json
file when using Angular-CLI but of course you can also use import statement to do so. The same goes for the CSS files which can be imported in the main index.scss
file.
Hi @jfcere I know that the doumentation mentioned that it should be added to angular.json but it should be added also to the angular component that is using the markdown tag to work.
Adding the Prism files to every component is not necessary, I would suggest you take a look at the ngx-markdown demo folder as a reference.
You won't find any import regarding Prism files elsewhere than in the angular.json
file at the root of the repository.
If you are experiencing any issue in a public repository, please feel free to share it with me and I'll be happy take a look at it to help you find the source of the problem.
Hi all, i ran into the exact same problem. It seems like when including "prismjs/components/prism-php.min.js" all other prism lexing fails. Does commenting that line out solve your problem, @jfcere ? I will continue to investigate, but it seems to me this is a prism bug, not related to this repository.
I can confirm that removing the file @winterle mentioned fixes the issue of getting
TypeError: Cannot read property 'tokenizePlaceholders' of undefined
With a quick search through Prism issues I found this comment: https://github.com/PrismJS/prism/issues/1400#issuecomment-485847919
Let me know if it fixes your issue.
I haven't heard from anybody for 3 weeks, since the problem comes from Prism library and the solution has been provided I will close the issue.
If you are still having issues after applying the solution provided by Prism, please feel free to respond and I will reopen if necessary.
Hi, There is a missing configuration that need to be added to the documentation to get prismjs code highlighting work. These imports need to be added also to the component TS file before using tag for code highlighting, without it the code highlighting doesn't work for prismjs custom components
import "prismjs/components/prism-typescript";
import "prismjs/components/prism-json";
import "prismjs/components/prism-scss";
import "prismjs/plugins/line-numbers/prism-line-numbers";