UNPKG

vue-markdown-wasm

Version:
13 lines (11 loc) 2.12 kB
/** * vue-markdown-wasm * * @description markdown-wasm for vue 2 & 3 * @author Logue <logue@hotmail.co.jp> * @copyright 2022-2025 By Masashi Yoshikawa All rights reserved. * @license MIT * @version 0.5.2 * @see {@link https://github.com/logue/vue-markdown-wasm} */ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("@logue/markdown-wasm"),r=require("vue-demi");const c={version:"0.5.2",date:"2025-07-12T05:52:57.079Z"},m=e=>e?Object.entries(e).reduce((n,[a,l])=>(a=a.charAt(0).toUpperCase()+a.slice(1),a=`on${a}`,{...n,[a]:l}),{}):{};function f(e,n={},a){if(r.isVue2)return r.h(e,n,a);const{props:l,domProps:o,on:t,...d}=n,s=t!=null?m(t):{};return r.h(e,{...d,...l,...o,...s},a)}var u=r.defineComponent({name:"VueMarkdown",model:{prop:"modelValue"},props:{modelValue:{type:String,default:""},tag:{type:String,default:"article"},parseFlags:{type:Number,default:i.ParseFlags.DEFAULT},format:{type:String,default:"xhtml"},bytes:{type:Boolean,default:!1},allowJsUri:{type:Boolean,default:!1},onCodeBlock:{type:Function},debug:{type:Boolean,default:!1},verbatimEntities:{type:Boolean,default:!0},disableHeadlineAnchors:{type:Boolean,default:!1}},emits:{render:e=>!0},setup(e,n){const a=r.ref(),l=r.ref("");r.watch(()=>e,async t=>{l.value=o(t.modelValue,{parseFlags:t.parseFlags,xhtml:t.format==="xhtml",bytes:e.bytes,allowJSURIs:t.allowJsUri,onCodeBlock:t.onCodeBlock,debug:t.debug,verbatimEntities:t.verbatimEntities,disableHeadlineAnchors:t.disableHeadlineAnchors}),await r.nextTick()},{deep:!0}),r.onMounted(async()=>{await i.ready(),l.value=o(e.modelValue,{parseFlags:e.parseFlags,xhtml:e.format=="xhtml",bytes:e.bytes,allowJSURIs:e.allowJsUri,onCodeBlock:e.onCodeBlock,debug:e.debug,verbatimEntities:e.verbatimEntities,disableHeadlineAnchors:e.disableHeadlineAnchors})});const o=(t,d)=>{const s=i.parse(t,d);return n.emit("render",s),s};return n.expose({render:o}),{placeholder:a,html:l}},render(){return f(this.$props.tag,{ref:"placeholder",class:"vue-markdown",innerHTML:this.html})}});const b=e=>e.component("VueMarkdown",u);exports.Meta=c;exports.default=u;exports.install=b;