mirror of
https://github.com/alrayyes/wiki.git
synced 2025-06-21 04:26:33 +00:00
refactor: General performance/style improvements (#262)
This commit is contained in:
parent
dc43737896
commit
614a6222a1
10 changed files with 84 additions and 66 deletions
assets/js
|
@ -40,8 +40,8 @@ const removeMarkdown = (
|
|||
.replace(/^\s{0,3}>\s?/g, "")
|
||||
.replace(/(^|\n)\s{0,3}>\s?/g, "\n\n")
|
||||
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "")
|
||||
.replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
|
||||
.replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
|
||||
.replace(/([\*_]{1,3})(\S.*?\S?)\1/g, "$2")
|
||||
.replace(/([\*_]{1,3})(\S.*?\S?)\1/g, "$2")
|
||||
.replace(/(`{3,})(.*?)\1/gm, "$2")
|
||||
.replace(/`(.+?)`/g, "$1")
|
||||
.replace(/\n{2,}/g, "\n\n")
|
||||
|
@ -65,7 +65,7 @@ const highlight = (content, term) => {
|
|||
.split(" ")
|
||||
.slice(0, h)
|
||||
return (
|
||||
(before.length == h ? `...${before.join(" ")}` : before.join(" ")) +
|
||||
(before.length === h ? `...${before.join(" ")}` : before.join(" ")) +
|
||||
`<span class="search-highlight">${term}</span>` +
|
||||
after.join(" ")
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue