1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Remove manual script tag filter and use turndown remove filter

This commit is contained in:
AWolf81
2019-08-31 21:35:09 +02:00
parent 72b8d56245
commit ec47ee8110
2 changed files with 2 additions and 12 deletions

View File

@@ -4,5 +4,6 @@ const { gfm } = require('turndown-plugin-gfm')
export const createTurndownService = function () {
const turndown = new TurndownService()
turndown.use(gfm)
turndown.remove('script')
return turndown
}

View File

@@ -32,18 +32,7 @@ function createNoteFromUrl (url, storage, folder, dispatch = null, location = nu
})
res.on('end', () => {
const html = document.createElement('html')
html.innerHTML = data
const scripts = html.getElementsByTagName('script')
for (let i = scripts.length - 1; i >= 0; i--) {
scripts[i].parentNode.removeChild(scripts[i])
}
const body = html.getElementsByTagName('body')[0].innerHTML
const markdownHTML = td.turndown(body)
html.innerHTML = ''
const markdownHTML = td.turndown(data)
if (dispatch !== null) {
createNote(storage, {