marked-plaintify
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -0,1 +1,8 @@ | ||
## marked-plaintify [1.0.1](https://github.com/bent10/marked-extensions/compare/marked-plaintify@1.0.0...marked-plaintify@1.0.1) (2024-04-23) | ||
### Bug Fixes | ||
* escape `html`, `code`, and `codespan` text ([149512d](https://github.com/bent10/marked-extensions/commit/149512dfe46c0f85a85a6ff0e0c06cb9c5c6230d)) | ||
# marked-plaintify 1.0.0 (2024-04-22) | ||
@@ -2,0 +9,0 @@ |
@@ -1,7 +0,9 @@ | ||
import { Renderer as _ } from "marked"; | ||
function m(r = {}) { | ||
const t = {}, c = ["constructor", "hr", "checkbox", "br"], a = ["strong", "em", "codespan", "del", "text"]; | ||
let s = []; | ||
return Object.getOwnPropertyNames(_.prototype).forEach((e) => { | ||
c.includes(e) ? t[e] = () => "" : a.includes(e) ? t[e] = (n) => n : e === "list" ? t[e] = (n) => ` | ||
import { Renderer as u } from "marked"; | ||
function o(i = {}) { | ||
const t = {}, c = ["constructor", "hr", "checkbox", "br"], r = ["strong", "em", "codespan", "del", "text"], f = ["html", "code", "codespan"]; | ||
let a = []; | ||
return Object.getOwnPropertyNames(u.prototype).forEach((e) => { | ||
c.includes(e) ? t[e] = () => "" : r.includes(e) ? t[e] = (n) => n : f.includes(e) ? t[e] = (n) => m(n) + ` | ||
` : e === "list" ? t[e] = (n) => ` | ||
` + n.trim() + ` | ||
@@ -12,9 +14,9 @@ | ||
` : e === "table" ? t[e] = (n, l) => (s = [], l) : e === "tablerow" ? t[e] = (n) => { | ||
const l = n.split("__CELL_PAD__").filter(Boolean); | ||
return s.map((i, f) => i + ": " + l[f]).join(` | ||
` : e === "table" ? t[e] = (n, s) => (a = [], s) : e === "tablerow" ? t[e] = (n) => { | ||
const s = n.split("__CELL_PAD__").filter(Boolean); | ||
return a.map((l, d) => l + ": " + s[d]).join(` | ||
`) + ` | ||
`; | ||
} : e === "tablecell" ? t[e] = (n, l) => (l.header && s.push(n), n + "__CELL_PAD__") : e === "link" || e === "image" ? t[e] = (n, l, i) => i || "" : t[e] = (n) => n + ` | ||
} : e === "tablecell" ? t[e] = (n, s) => (s.header && a.push(n), n + "__CELL_PAD__") : e === "link" || e === "image" ? t[e] = (n, s, l) => l || "" : t[e] = (n) => n + ` | ||
@@ -25,8 +27,18 @@ `; | ||
...t, | ||
...r | ||
...i | ||
} | ||
}; | ||
} | ||
function m(i) { | ||
const t = { | ||
"&": "&", | ||
"<": "<", | ||
">": ">", | ||
'"': """, | ||
"'": "'" | ||
}; | ||
return i.replace(/[&<>"']/g, (c) => t[c]); | ||
} | ||
export { | ||
m as default | ||
o as default | ||
}; |
@@ -1,2 +0,4 @@ | ||
(function(i,l){typeof exports=="object"&&typeof module<"u"?module.exports=l(require("marked")):typeof define=="function"&&define.amd?define(["marked"],l):(i=typeof globalThis<"u"?globalThis:i||self,i.markedPlaintify=l(i.marked))})(this,function(i){"use strict";function l(r={}){const t={},u=["constructor","hr","checkbox","br"],c=["strong","em","codespan","del","text"];let f=[];return Object.getOwnPropertyNames(i.Renderer.prototype).forEach(e=>{u.includes(e)?t[e]=()=>"":c.includes(e)?t[e]=n=>n:e==="list"?t[e]=n=>` | ||
(function(i,l){typeof exports=="object"&&typeof module<"u"?module.exports=l(require("marked")):typeof define=="function"&&define.amd?define(["marked"],l):(i=typeof globalThis<"u"?globalThis:i||self,i.markedPlaintify=l(i.marked))})(this,function(i){"use strict";function l(d={}){const t={},f=["constructor","hr","checkbox","br"],a=["strong","em","codespan","del","text"],m=["html","code","codespan"];let r=[];return Object.getOwnPropertyNames(i.Renderer.prototype).forEach(e=>{f.includes(e)?t[e]=()=>"":a.includes(e)?t[e]=n=>n:m.includes(e)?t[e]=n=>u(n)+` | ||
`:e==="list"?t[e]=n=>` | ||
`+n.trim()+` | ||
@@ -7,7 +9,7 @@ | ||
`:e==="table"?t[e]=(n,s)=>(f=[],s):e==="tablerow"?t[e]=n=>{const s=n.split("__CELL_PAD__").filter(Boolean);return f.map((d,a)=>d+": "+s[a]).join(` | ||
`:e==="table"?t[e]=(n,s)=>(r=[],s):e==="tablerow"?t[e]=n=>{const s=n.split("__CELL_PAD__").filter(Boolean);return r.map((c,o)=>c+": "+s[o]).join(` | ||
`)+` | ||
`}:e==="tablecell"?t[e]=(n,s)=>(s.header&&f.push(n),n+"__CELL_PAD__"):e==="link"||e==="image"?t[e]=(n,s,d)=>d||"":t[e]=n=>n+` | ||
`}:e==="tablecell"?t[e]=(n,s)=>(s.header&&r.push(n),n+"__CELL_PAD__"):e==="link"||e==="image"?t[e]=(n,s,c)=>c||"":t[e]=n=>n+` | ||
`}),{renderer:{...t,...r}}}return l}); | ||
`}),{renderer:{...t,...d}}}function u(d){const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return d.replace(/[&<>"']/g,f=>t[f])}return l}); |
{ | ||
"name": "marked-plaintify", | ||
"description": "A marked extension to convert Markdown to Plaintext", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"publishConfig": { | ||
@@ -6,0 +6,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
11176
72