Skip to content

Commit

Permalink
Merge pull request #64 from terwer/dev
Browse files Browse the repository at this point in the history
feat:#59 标题支持数字编号
  • Loading branch information
terwer authored Aug 25, 2022
2 parents 15c72a0 + 9d9cd7f commit 471678c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/lib/htmlUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,23 @@ export function mdToHtml(md: string) {
* @returns {*|string} 删除后的字符
*/
export function removeWidgetTag(str: string) {
let newstr = str

// 旧版发布挂件
const publisherRegex = /<iframe.*src="\/widgets\/publisher.*<\/iframe>/g;
str = str.replaceAll(publisherRegex, "")
newstr = newstr.replaceAll(publisherRegex, "")

// 新版发布挂件
const syPublisherRegex = /<iframe.*src="\/widgets\/sy-post-publisher.*<\/iframe>/g;
str = str.replaceAll(syPublisherRegex, "")
newstr = newstr.replaceAll(syPublisherRegex, "")

// 文章属性挂件
const noteAttrRegex = /<iframe.*\/widgets\/Note*\sAttrs.*\/iframe>/g
str = str.replaceAll(noteAttrRegex, "")
newstr = newstr.replaceAll(noteAttrRegex, "")

const h1Regex = /<h1.*\/h1>/g
newstr = newstr.replace(h1Regex, "")

return str
}

Expand Down

1 comment on commit 471678c

@vercel
Copy link

@vercel vercel bot commented on 471678c Aug 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.