vue-markdown-wasm
Version:
markdown-wasm for vue 2 & 3
13 lines (11 loc) • 2.27 kB
JavaScript
/**
* 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 1.0.1
* @see {@link https://github.com/logue/vue-markdown-wasm}
*/
var VueMarkdown=(function(r,i,n){"use strict";const f={name:"vue-markdown-wasm",version:"1.0.1",author:{name:"Logue",email:"logue@hotmail.co.jp",url:"https://logue.dev/"},date:"2025-10-23T01:25:22.768Z"},b=e=>e?Object.entries(e).reduce((l,[a,o])=>(a=a.charAt(0).toUpperCase()+a.slice(1),a=`on${a}`,{...l,[a]:o}),{}):{};function h(e,l={},a){if(n.isVue2)return n.h(e,l,a);const{props:o,domProps:s,on:t,...u}=l,d=t!=null?b(t):{};return n.h(e,{...u,...o,...s,...d},a)}const c=n.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,l){const a=n.ref(),o=n.ref("");n.watch(()=>e,async t=>{o.value=s(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 n.nextTick()},{deep:!0}),n.onMounted(async()=>{globalThis.window!==void 0&&(await i.ready(),o.value=s(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 s=(t,u)=>{if(globalThis.window===void 0)return"";const d=i.parse(t,u);return l.emit("render",d),d};return l.expose({render:s}),{placeholder:a,html:o}},render(){return h(this.$props.tag,{ref:"placeholder",class:"vue-markdown",innerHTML:this.html})}}),m=e=>e.component("VueMarkdown",c);return r.Meta=f,r.default=c,r.install=m,Object.defineProperty(r,"__esModule",{value:!0}),r})({},markdown,VueDemi);