Open mastastealth opened 6 years ago
Is this possible with vue-markdown
? I'd like to have customization (embedding) too.
You can do some simple stuff using postrender like so:
<vue-markdown :postrender="postRender">test @user</vue-markdown>
and in your script make a function that does whatever you want
function postRender(input: any){
// format (space)@(word) in a span with "tag" class
let output = input.replace(/(\s)#([a-z0-9-]+)/g,"$1<span class='user'>$2</span>");
return output;
}
One thing to note is that this is after all the markdown is added, so where you think there is a \n
newline, there might be a <
from a br that was added
I was wondering if there was a simple way to modify the rules. E.g.:
*bold*
and_italic_
#n
, where n is a number, could link to some "post" in your app (i.e. swap with an auto link)@user
can convert to a link (to a user profile)