Viewer.vue (867B)
1 <template> 2 <div class="main-wrapper" v-html="adocRendered"></div> 3 </template> 4 5 6 <script> 7 const adoc = require("asciidoctor")(); 8 export default { 9 name: "Viewer", 10 props: { 11 adocSource: String 12 }, 13 data() { 14 return { 15 adocRendered: "" 16 } 17 }, 18 mounted() { 19 this.adocRendered = adoc.convert(this.adocSource, {safe: 'safe'}); 20 if (!window.MathJax) { 21 return; 22 } 23 this.$nextTick().then(() => { 24 window.MathJax.Hub.Typeset(); 25 // Thanks: 26 // - https://docs.mathjax.org/en/v2.7-latest/advanced/typeset.html 27 // - https://stackoverflow.com/questions/52636554/mathjax-vue-not-rerendering-equations 28 }); 29 } 30 } 31 </script> 32 33 34 <style scoped> 35 </style>