✨ (twitter) implement tweets in notes
This commit is contained in:
10
src/utils/markdown/markdown-it-twitter.ts
Normal file
10
src/utils/markdown/markdown-it-twitter.ts
Normal 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>`
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user