-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to fix Error in render "TypeError: (0 , _components.default) is not a function" #194
Comments
Hi @steven-lury, thanks for reporting this! At first glance, this looks like a bug in I am quite busy at the moment, so please excuse if it takes a little longer until you hear back. I’ll try to investigate as soon as I find the time. |
Hi @jGleitz and @steven-lury I've encountered the same problem. Managed to make a workaround as in #28 by adding imports for all languages I need: import "prismjs/components/prism-bash"
import "prismjs/components/prism-json"
import "prismjs/components/prism-go"
import "prismjs/components/prism-clike"
import "prismjs/components/prism-javascript"
import "prismjs/components/prism-java" Unfortunately there is still a problem of unimported or unsupported languages. After some googling found this link: https://youtrack.jetbrains.com/issue/KTOR-1331 stating:
Hope this helps. |
@GrimmKull do I understand you correctly, that
@steven-lury does that help you fix the issue? |
@jGleitz Not completely. Only if I do not use any other language other than the ones listed and if I do not make a mistake like typing (0, _components.default)([lang]); Tried 2 more things today and this works well enough for me:
if (langObject === undefined) {
// (0, _components.default)([lang]);
// langObject = _prismjs.default.languages[lang];
langObject = _prismjs.default.languages['clike'];
}
let md = new MarkdownIt().use(MarkdownItPrism, {defaultLanguage: 'clike'}) This takes care of both missing imports and unsupported languages. |
@GrimmKull the second option is how this plugin is meant to be used if you need a fallback. Hence, I will go ahead and close this issue. Please feel free to open another issue if you have further suggestions for improvement! |
I'm using Vuejs & webpack. I installed
markdown-it.js
&markdown-it-prism
together and use them insideMEditor.vue
Inside
MEditor.vue
I have like this:when I write
php public function foo() { return false; }
I get errors below:[Vue warn]: Error in render: "TypeError: (0 , _components.default) is not a function"
at loadPrismLang (app.js:36167)
at selectLanguage (app.js:36206)
at highlight (app.js:36232)
at Object.markdownit.options.highlight (app.js:36280)
at Object../node_modules/markdown-it/lib/renderer.js.default_rules.fence (app.js:38275)
at Renderer../node_modules/markdown-it/lib/renderer.js.Renderer.render (app.js:38551)
at MarkdownIt../node_modules/markdown-it/lib/index.js.MarkdownIt.render (app.js:37560)
at VueComponent.preview (app.js:16085)
at Watcher.get (app.js:63325)
at Watcher.evaluate (app.js:63430)
The text was updated successfully, but these errors were encountered: