mirror of
https://github.com/Kenshin/simpread.git
synced 2026-01-25 14:28:34 +00:00
Optimize clearMD() logic.
This commit is contained in:
parent
a4b627fa53
commit
014ea8abab
@ -119,9 +119,12 @@ function md2enml( result ) {
|
||||
* Clear Html to MD, erorr <tag>
|
||||
*
|
||||
* @param {string} convert string
|
||||
* @param {boolen} header
|
||||
*
|
||||
* @return {string} format string
|
||||
*/
|
||||
function clearMD( str ) {
|
||||
str = `> 本文由 [简悦 SimpRead](http://ksria.com/simpread/) 转码, 原文地址 ${ window.location.href } \r\n\r\n ${str}`;
|
||||
function clearMD( str, header = true ) {
|
||||
header && ( str = `> 本文由 [简悦 SimpRead](http://ksria.com/simpread/) 转码, 原文地址 ${ window.location.href } \r\n\r\n ${str}` );
|
||||
str = str.replace( /<\/?(ins|font|span|div|canvas|noscript|fig\w+)[ -\w*= \w=\-.:&\/\/?!;,%+()#'"{}\u4e00-\u9fa5]*>/ig, "" )
|
||||
.replace( /sr-blockquote/ig, "blockquote" )
|
||||
.replace( /<\/?style[ -\w*= \w=\-.:&\/\/?!;,+()#"\S]*>/ig, "" )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user