Skip to content

Commit

Permalink
fix: force string conversion in prism
Browse files Browse the repository at this point in the history
It looks like there is a difference in behavior that I don't really get, but without forcing the string conversion, all our tests are failing with "`code.trim` is not a function" because `code` contains an object and not a string (it is the result of the `require` calls to laod the dynamic snippets). I may be missing something obvious, but this fixes the issue.
  • Loading branch information
cexbrayat committed Feb 7, 2020
1 parent 5e49b28 commit aec5b1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion projects/demo/src/app/prism.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import 'prismjs/components/prism-typescript';
export class PrismService {

highlight(code: string, lang: string) {
return prism.highlight(code.trim(), prism.languages[lang], lang);
return prism.highlight(code.toString().trim(), prism.languages[lang], lang);
}
}

0 comments on commit aec5b1d

Please sign in to comment.