You've already forked remark-ofm
Add frontmatter security
This commit is contained in:
10
src/index.ts
10
src/index.ts
@@ -179,6 +179,16 @@ export default function ofm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tag = slugTag(tag)
|
tag = slugTag(tag)
|
||||||
|
|
||||||
|
if (!file.data)
|
||||||
|
file.data = {};
|
||||||
|
|
||||||
|
if (!file.data.frontmatter)
|
||||||
|
file.data.frontmatter = {};
|
||||||
|
|
||||||
|
if (!file.data.frontmatter.tags)
|
||||||
|
file.data.frontmatter.tags = [];
|
||||||
|
|
||||||
if (file.data.frontmatter && !file.data.frontmatter.tags.includes(tag)) {
|
if (file.data.frontmatter && !file.data.frontmatter.tags.includes(tag)) {
|
||||||
file.data.frontmatter.tags.push(tag)
|
file.data.frontmatter.tags.push(tag)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user