fix mdast library conflict
This commit is contained in:
parent
4bfd021342
commit
e09ea310cd
10
lib/md.js
10
lib/md.js
|
@ -1,12 +1,12 @@
|
|||
import { fromMarkdown } from 'mdast-util-from-markdown'
|
||||
import { gfmFromMarkdown } from 'mdast-util-gfm'
|
||||
import { visit } from 'unist-util-visit'
|
||||
import gfm from 'remark-gfm'
|
||||
import { gfm } from 'micromark-extension-gfm'
|
||||
import { fromMarkdown } from 'mdast-util-from-markdown'
|
||||
|
||||
export function mdHas (md, test) {
|
||||
if (!md) return []
|
||||
const tree = fromMarkdown(md, {
|
||||
extensions: [gfm],
|
||||
extensions: [gfm()],
|
||||
mdastExtensions: [gfmFromMarkdown()]
|
||||
})
|
||||
|
||||
|
@ -22,10 +22,12 @@ export function mdHas (md, test) {
|
|||
export function extractUrls (md) {
|
||||
if (!md) return []
|
||||
const tree = fromMarkdown(md, {
|
||||
extensions: [gfm],
|
||||
extensions: [gfm()],
|
||||
mdastExtensions: [gfmFromMarkdown()]
|
||||
})
|
||||
|
||||
console.log('tree', tree)
|
||||
|
||||
const urls = new Set()
|
||||
visit(tree, ({ type }) => {
|
||||
return type === 'link' || type === 'image'
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,7 +21,7 @@
|
|||
"acorn": "^8.10.0",
|
||||
"ajv": "^8.12.0",
|
||||
"async-retry": "^1.3.1",
|
||||
"aws-sdk": "^2.1421.0",
|
||||
"aws-sdk": "^2.1422.0",
|
||||
"babel-plugin-inline-react-svg": "^2.0.2",
|
||||
"bech32": "^2.0.0",
|
||||
"bolt11": "^1.4.1",
|
||||
|
@ -40,7 +40,9 @@
|
|||
"mathjs": "^11.9.1",
|
||||
"mdast-util-find-and-replace": "^3.0.0",
|
||||
"mdast-util-from-markdown": "^2.0.0",
|
||||
"mdast-util-gfm": "^3.0.0",
|
||||
"mdast-util-to-string": "^4.0.0",
|
||||
"micromark-extension-gfm": "^3.0.0",
|
||||
"next": "^13.4.12",
|
||||
"next-auth": "^3.29.10",
|
||||
"next-plausible": "^3.10.1",
|
||||
|
|
Loading…
Reference in New Issue