New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

marked-plaintify

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marked-plaintify - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

7

changelog.md

@@ -0,1 +1,8 @@

# marked-plaintify [1.1.0](https://github.com/bent10/marked-extensions/compare/marked-plaintify@1.0.1...marked-plaintify@1.1.0) (2024-07-30)
### Features
* :arrow_up: Ported marked-plaintify to Marked v13. ([243d0d0](https://github.com/bent10/marked-extensions/commit/243d0d05c7f642b62a25272b19336a5a3727b095))
## 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)

@@ -2,0 +9,0 @@

4

dist/index.d.ts

@@ -1,2 +0,2 @@

import { MarkedExtension, RendererObject } from 'marked';
import { Renderer, MarkedExtension, RendererObject } from 'marked';
/**

@@ -9,3 +9,3 @@ * Options for configuring the markedPlaintify extension.

*/
[k: string]: (...args: any[]) => string | false;
[k: string]: (this: Renderer, ...args: any[]) => string | false;
};

@@ -12,0 +12,0 @@ /**

@@ -1,32 +0,78 @@

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) + `
import { Renderer as x } from "marked";
function g(c = {}) {
const s = {}, a = ["constructor", "hr", "checkbox", "br", "space"], h = ["strong", "em", "del"], d = ["html", "code"];
let f = [];
return Object.getOwnPropertyNames(x.prototype).forEach((t) => {
a.includes(t) ? s[t] = () => "" : h.includes(t) ? s[t] = function(e) {
return this.parser.parseInline(e.tokens);
} : d.includes(t) ? s[t] = (e) => o(e.text) + `
` : e === "list" ? t[e] = (n) => `
` : t === "codespan" ? s[t] = (e) => o(e.text) : t === "list" ? s[t] = function(e) {
let n = "";
for (let r = 0; r < e.items.length; r++) {
const i = e.items[r], l = this.listitem(i);
typeof l == "string" && (n += l.replace(/\n{2,}/g, `
`));
}
return `
` + n.trim() + `
` : e === "listitem" ? t[e] = (n) => `
` + n.trim() : e === "blockquote" ? t[e] = (n) => n.trim() + `
`;
} : t === "listitem" ? s[t] = function(e) {
return `
` + this.parser.parse(e.tokens).trim();
} : t === "blockquote" ? s[t] = function(e) {
return this.parser.parse(e.tokens).trim() + `
` : 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(`
`;
} : t === "table" ? s[t] = function(e) {
f = [];
for (let r = 0; r < e.header.length; r++)
this.tablecell(e.header[r]);
let n = "";
for (let r = 0; r < e.rows.length; r++) {
const i = e.rows[r];
let l = "";
for (let u = 0; u < i.length; u++)
l += this.tablecell(i[u]);
n += this.tablerow({ text: l });
}
return n;
} : t === "tablerow" ? s[t] = (e) => {
const n = e.text.split("__CELL_PAD__").filter(Boolean);
return f.map((r, i) => r + ": " + n[i]).join(`
`) + `
`;
} : 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 + `
} : t === "tablecell" ? s[t] = function(e) {
const n = this.parser.parseInline(e.tokens);
return e.header && f.push(n), n + "__CELL_PAD__";
} : t === "link" ? s[t] = function(e) {
return this.parser.parseInline(e.tokens) + `
`;
} : t === "image" ? s[t] = (e) => e.text + `
` : t === "paragraph" ? s[t] = function(e) {
let n = this.parser.parseInline(e.tokens);
return n = n.replace(/\n{2,}/g, ""), n + `
`;
} : t === "heading" ? s[t] = function(e) {
return this.parser.parseInline(e.tokens) + `
`;
} : s[t] = function(e) {
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : e.text;
};
}), {
useNewRenderer: !0,
renderer: {
...t,
...i
...s,
...c
}
};
}
function m(i) {
const t = {
function o(c) {
const s = {
"&": "&amp;",

@@ -38,6 +84,6 @@ "<": "&lt;",

};
return i.replace(/[&<>"']/g, (c) => t[c]);
return c.replace(/[&<>"']/g, (a) => s[a]);
}
export {
o as default
g as default
};

@@ -1,14 +0,21 @@

(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)+`
(function(r,c){typeof exports=="object"&&typeof module<"u"?module.exports=c(require("marked")):typeof define=="function"&&define.amd?define(["marked"],c):(r=typeof globalThis<"u"?globalThis:r||self,r.markedPlaintify=c(r.marked))})(this,function(r){"use strict";function c(f={}){const s={},u=["constructor","hr","checkbox","br","space"],m=["strong","em","del"],x=["html","code"];let o=[];return Object.getOwnPropertyNames(r.Renderer.prototype).forEach(t=>{u.includes(t)?s[t]=()=>"":m.includes(t)?s[t]=function(e){return this.parser.parseInline(e.tokens)}:x.includes(t)?s[t]=e=>h(e.text)+`
`:e==="list"?t[e]=n=>`
`:t==="codespan"?s[t]=e=>h(e.text):t==="list"?s[t]=function(e){let n="";for(let i=0;i<e.items.length;i++){const l=e.items[i],a=this.listitem(l);typeof a=="string"&&(n+=a.replace(/\n{2,}/g,`
`))}return`
`+n.trim()+`
`:e==="listitem"?t[e]=n=>`
`+n.trim():e==="blockquote"?t[e]=n=>n.trim()+`
`}:t==="listitem"?s[t]=function(e){return`
`+this.parser.parse(e.tokens).trim()}:t==="blockquote"?s[t]=function(e){return this.parser.parse(e.tokens).trim()+`
`: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(`
`}:t==="table"?s[t]=function(e){o=[];for(let i=0;i<e.header.length;i++)this.tablecell(e.header[i]);let n="";for(let i=0;i<e.rows.length;i++){const l=e.rows[i];let a="";for(let d=0;d<l.length;d++)a+=this.tablecell(l[d]);n+=this.tablerow({text:a})}return n}:t==="tablerow"?s[t]=e=>{const n=e.text.split("__CELL_PAD__").filter(Boolean);return o.map((i,l)=>i+": "+n[l]).join(`
`)+`
`}: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+`
`}:t==="tablecell"?s[t]=function(e){const n=this.parser.parseInline(e.tokens);return e.header&&o.push(n),n+"__CELL_PAD__"}:t==="link"?s[t]=function(e){return this.parser.parseInline(e.tokens)+`
`}),{renderer:{...t,...d}}}function u(d){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return d.replace(/[&<>"']/g,f=>t[f])}return l});
`}:t==="image"?s[t]=e=>e.text+`
`:t==="paragraph"?s[t]=function(e){let n=this.parser.parseInline(e.tokens);return n=n.replace(/\n{2,}/g,""),n+`
`}:t==="heading"?s[t]=function(e){return this.parser.parseInline(e.tokens)+`
`}:s[t]=function(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}),{useNewRenderer:!0,renderer:{...s,...f}}}function h(f){const s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return f.replace(/[&<>"']/g,u=>s[u])}return c});
{
"name": "marked-plaintify",
"description": "A marked extension to convert Markdown to Plaintext",
"version": "1.0.1",
"version": "1.1.0",
"publishConfig": {

@@ -51,4 +51,4 @@ "access": "public"

"peerDependencies": {
"marked": ">=7.0.0"
"marked": ">=13.0.0"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc