File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 line-height : 24px ;
4444 }
4545
46- :not (pre ) code {
46+ :not (pre ) > code {
4747 color : var (--color-code );
4848 background : var (--color-code-bg );
4949 }
Original file line number Diff line number Diff line change 1+ <!-- eslint-disable vue/one-component-per-file -->
12<script >
2- import { compile , h } from ' vue'
3+ import { h , defineComponent } from ' vue'
34 import meta from ' markdown-it-meta'
45 import MarkdownIt from ' markdown-it'
56 import plugins from ' ./plugins'
4142 immediate: true ,
4243 },
4344 },
44- mounted : () => {
45+ mounted () {
4546 codeGroups ()
4647 },
4748 render () {
48- return h (compile (this .renderedDocument )(this ))
49+ if (! this .renderedDocument ) {
50+ return h (' div' )
51+ }
52+
53+ try {
54+ // Create a wrapper component with the rendered markdown
55+ const template = ` <div class="markdown-content">${ this .renderedDocument } </div>`
56+ const component = defineComponent ({
57+ template,
58+ components: this .$options .components ,
59+ })
60+ return h (component)
61+ } catch (error) {
62+ console .error (' Markdown render error:' , error)
63+ return h (' div' , {
64+ class: ' markdown-error' ,
65+ innerHTML: this .renderedDocument ,
66+ })
67+ }
4968 },
5069 }
5170< / script>
Original file line number Diff line number Diff line change 3737 },
3838
3939 render () {
40- return h (compile (this .renderedDocument , { delimiters: [' ${{' , ' }}' ] })(this ))
40+ if (! this .renderedDocument ) {
41+ return h (' div' )
42+ }
43+
44+ try {
45+ return h (' div' , {
46+ class: ' markdown-render' ,
47+ innerHTML: this .renderedDocument ,
48+ })
49+ } catch (error) {
50+ console .error (' Markdown render error:' , error)
51+ return h (' div' , { class: ' markdown-error' }, ' Error rendering content' )
52+ }
4153 },
4254 }
4355 </script >
You can’t perform that action at this time.
0 commit comments