(twitter) implement tweets in notes

This commit is contained in:
Julien Calixte
2023-07-04 23:17:47 +02:00
parent 5eeb78e366
commit d6a045f96b
7 changed files with 140 additions and 65 deletions

View File

@@ -0,0 +1,10 @@
import { markdownItPlugin } from '@/utils/markdown/markdown-it-regexp'
export const twitterPlugin = markdownItPlugin(
/@\[tweet]\((.*?)\)/g,
(matches: RegExpExecArray[]) => {
const [_, tweetId] = matches
return `<span id="tweet-${tweetId}" data-tweet-id="${tweetId}" class="markdown-tweet"></span>`
}
)