mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Fixed #525
HTML is removed. In this way, if a URL is changed, it can be highlighted as well
This commit is contained in:
18
src/helpers/removeHTML.ts
Normal file
18
src/helpers/removeHTML.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import htmlparser2 from 'htmlparser2-without-node-native'
|
||||
|
||||
const removeHTML = (text: string): string => {
|
||||
let raw: string = ''
|
||||
|
||||
const parser = new htmlparser2.Parser({
|
||||
ontext: (text: string) => {
|
||||
raw = raw + text
|
||||
}
|
||||
})
|
||||
|
||||
parser.write(text)
|
||||
parser.end()
|
||||
|
||||
return raw
|
||||
}
|
||||
|
||||
export default removeHTML
|
Reference in New Issue
Block a user