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

remark-slate

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-slate - npm Package Compare versions

Comparing version 1.2.2 to 1.3.0

52

dist/deserialize.d.ts

@@ -17,2 +17,5 @@ export interface NodeTypes {

};
emphasis_mark?: string;
strong_mark?: string;
delete_mark?: string;
}

@@ -52,2 +55,5 @@ export interface OptionType {

};
emphasis_mark: string;
strong_mark: string;
delete_mark: string;
};

@@ -62,3 +68,2 @@ export default function deserialize(node: MdastNode, opts?: OptionType): {

break?: undefined;
text?: undefined;
} | {

@@ -72,3 +77,2 @@ type: string;

break?: undefined;
text?: undefined;
} | {

@@ -82,3 +86,2 @@ type: string;

break?: undefined;
text?: undefined;
} | {

@@ -92,3 +95,2 @@ break: boolean;

language?: undefined;
text?: undefined;
} | {

@@ -107,47 +109,5 @@ type?: string | undefined;

indent?: any;
italic: boolean;
link?: undefined;
language?: undefined;
break?: undefined;
} | {
type?: string | undefined;
ordered?: boolean | undefined;
value?: string | undefined;
text: string;
children?: MdastNode[] | undefined;
depth?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
url?: string | undefined;
lang?: string | undefined;
position?: any;
spread?: any;
checked?: any;
indent?: any;
bold: boolean;
link?: undefined;
language?: undefined;
break?: undefined;
} | {
type?: string | undefined;
ordered?: boolean | undefined;
value?: string | undefined;
text: string;
children?: MdastNode[] | undefined;
depth?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
url?: string | undefined;
lang?: string | undefined;
position?: any;
spread?: any;
checked?: any;
indent?: any;
strikeThrough: boolean;
link?: undefined;
language?: undefined;
break?: undefined;
} | {
text: string;
type?: undefined;
children?: undefined;
link?: undefined;
language?: undefined;
break?: undefined;
};

21

dist/remark-slate.cjs.development.js

@@ -42,6 +42,9 @@ 'use strict';

6: 'heading_six'
}
},
emphasis_mark: 'italic',
strong_mark: 'bold',
delete_mark: 'strikeThrough'
};
function deserialize(node, opts) {
var _opts, _opts$nodeTypes, _node$value;
var _opts, _opts$nodeTypes, _node$value, _extends2, _extends3, _extends4;

@@ -133,3 +136,3 @@ if (opts === void 0) {

return {
type: 'parapgraph',
type: 'paragraph',
children: [{

@@ -141,15 +144,9 @@ text: ''

case 'emphasis':
return _extends({
italic: true
}, forceLeafNode(children), persistLeafFormats(children));
return _extends((_extends2 = {}, _extends2[types.emphasis_mark] = true, _extends2), forceLeafNode(children), persistLeafFormats(children));
case 'strong':
return _extends({
bold: true
}, forceLeafNode(children), persistLeafFormats(children));
return _extends((_extends3 = {}, _extends3[types.strong_mark] = true, _extends3), forceLeafNode(children), persistLeafFormats(children));
case 'delete':
return _extends({
strikeThrough: true
}, forceLeafNode(children), persistLeafFormats(children));
return _extends((_extends4 = {}, _extends4[types.delete_mark] = true, _extends4), forceLeafNode(children), persistLeafFormats(children));

@@ -156,0 +153,0 @@ case 'text':

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=(e=require("escape-html"))&&"object"==typeof e&&"default"in e?e.default:e;function t(){return(t=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var n={paragraph:"paragraph",block_quote:"block_quote",code_block:"code_block",link:"link",ul_list:"ul_list",ol_list:"ol_list",listItem:"list_item",heading:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"}};function i(e,r){var o,u,c;void 0===r&&(r={nodeTypes:{}});var d=t({},n,r.nodeTypes,{heading:t({},n.heading,null===(o=r)||void 0===o||null===(u=o.nodeTypes)||void 0===u?void 0:u.heading)}),s=[{text:""}];switch(e.children&&Array.isArray(e.children)&&e.children.length>0&&(s=e.children.map((function(n){return i(t({},n,{ordered:e.ordered||!1}),r)}))),e.type){case"heading":return{type:d.heading[e.depth||1],children:s};case"list":return{type:e.ordered?d.ol_list:d.ul_list,children:s};case"listItem":return{type:d.listItem,children:s};case"paragraph":return{type:d.paragraph,children:s};case"link":return{type:d.link,link:e.url,children:s};case"blockquote":return{type:d.block_quote,children:s};case"code":return{type:d.code_block,language:e.lang,children:[{text:e.value}]};case"html":var p;return(null===(c=e.value)||void 0===c?void 0:c.includes("<br>"))?{break:!0,type:d.paragraph,children:[{text:(null===(p=e.value)||void 0===p?void 0:p.replace(/<br>/g,""))||""}]}:{type:"parapgraph",children:[{text:""}]};case"emphasis":return t({italic:!0},a(s),l(s));case"strong":return t({bold:!0},a(s),l(s));case"delete":return t({strikeThrough:!0},a(s),l(s));case"text":default:return{text:e.value||""}}}var a=function(e){return{text:e.map((function(e){return null==e?void 0:e.text})).join("")}};function l(e){return e.reduce((function(e,r){return Object.keys(r).forEach((function(t){"children"!==t&&"type"!==t&&"text"!==t&&(e[t]=r[t])})),e}),{})}var o=function(e){return"string"==typeof e.text};function u(e,r){var t=e.trim(),n=t,i=""+r+n+c(r);if(n.length===e.length)return i;var a=r+n+c(r);return e.replace(t,a)}var c=function(e){return e.split("").reverse().join("")};exports.default=function(e){this.Compiler=function(r){return r.children.map((function(r){return i(r,e)}))}},exports.defaultNodeTypes=n,exports.deserialize=i,exports.serialize=function e(i,a){void 0===a&&(a={nodeTypes:n});var l=a.nodeTypes,c=void 0===l?n:l,d=a.ignoreParagraphNewline,s=void 0!==d&&d,p=a.listDepth,h=void 0===p?0:p,g=i.text||"",y=i.type||"",v=t({},n,c,{heading:t({},n.heading,c.heading)}),f=[v.ul_list,v.ol_list],_=g;if(o(i)||(_=i.children.map((function(r){var n=!o(r)&&f.includes(r.type||""),a=f.includes(i.type||""),l=!1;return!o(i)&&Array.isArray(i.children)&&(l=i.children.some((function(e){return!o(e)&&e.type===v.link}))),e(t({},r,{parentType:y}),{nodeTypes:v,ignoreParagraphNewline:(s||n||a||l)&&!r.break,listDepth:f.includes(r.type||"")?h+1:h})})).join("")),s||""!==g&&"\n"!==g||i.parentType!==v.paragraph||(y=v.paragraph,_="<br>"),""!==_)switch("<br>"!==_&&o(i)&&(i.strikeThrough&&i.bold&&i.italic?_=u(_,"~~***"):i.bold&&i.italic?_=u(_,"***"):(i.bold&&(_=u(_,"**")),i.italic&&(_=u(_,"_")),i.strikeThrough&&(_=u(_,"~~")))),y){case v.heading[1]:return"# "+_+"\n";case v.heading[2]:return"## "+_+"\n";case v.heading[3]:return"### "+_+"\n";case v.heading[4]:return"#### "+_+"\n";case v.heading[5]:return"##### "+_+"\n";case v.heading[6]:return"###### "+_+"\n";case v.block_quote:return"> "+_+"\n\n";case v.code_block:return"```"+(i.language||"")+"\n"+_+"\n```\n";case v.link:return"["+_+"]("+(i.link||"")+")";case v.ul_list:case v.ol_list:return"\n"+_+"\n";case v.listItem:for(var b=i&&i.parentType===v.ol_list,k="",x=0;h>x;x++)k+=b?" ":" ";return k+(b?"1.":"-")+" "+_;case v.paragraph:return _+"\n";default:return r(_)}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=(e=require("escape-html"))&&"object"==typeof e&&"default"in e?e.default:e;function t(){return(t=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var n={paragraph:"paragraph",block_quote:"block_quote",code_block:"code_block",link:"link",ul_list:"ul_list",ol_list:"ol_list",listItem:"list_item",heading:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},emphasis_mark:"italic",strong_mark:"bold",delete_mark:"strikeThrough"};function a(e,r){var o,u,c,s,d,p;void 0===r&&(r={nodeTypes:{}});var h=t({},n,r.nodeTypes,{heading:t({},n.heading,null===(o=r)||void 0===o||null===(u=o.nodeTypes)||void 0===u?void 0:u.heading)}),g=[{text:""}];switch(e.children&&Array.isArray(e.children)&&e.children.length>0&&(g=e.children.map((function(n){return a(t({},n,{ordered:e.ordered||!1}),r)}))),e.type){case"heading":return{type:h.heading[e.depth||1],children:g};case"list":return{type:e.ordered?h.ol_list:h.ul_list,children:g};case"listItem":return{type:h.listItem,children:g};case"paragraph":return{type:h.paragraph,children:g};case"link":return{type:h.link,link:e.url,children:g};case"blockquote":return{type:h.block_quote,children:g};case"code":return{type:h.code_block,language:e.lang,children:[{text:e.value}]};case"html":var y;return(null===(c=e.value)||void 0===c?void 0:c.includes("<br>"))?{break:!0,type:h.paragraph,children:[{text:(null===(y=e.value)||void 0===y?void 0:y.replace(/<br>/g,""))||""}]}:{type:"paragraph",children:[{text:""}]};case"emphasis":return t(((s={})[h.emphasis_mark]=!0,s),i(g),l(g));case"strong":return t(((d={})[h.strong_mark]=!0,d),i(g),l(g));case"delete":return t(((p={})[h.delete_mark]=!0,p),i(g),l(g));case"text":default:return{text:e.value||""}}}var i=function(e){return{text:e.map((function(e){return null==e?void 0:e.text})).join("")}};function l(e){return e.reduce((function(e,r){return Object.keys(r).forEach((function(t){"children"!==t&&"type"!==t&&"text"!==t&&(e[t]=r[t])})),e}),{})}var o=function(e){return"string"==typeof e.text};function u(e,r){var t=e.trim(),n=t,a=""+r+n+c(r);if(n.length===e.length)return a;var i=r+n+c(r);return e.replace(t,i)}var c=function(e){return e.split("").reverse().join("")};exports.default=function(e){this.Compiler=function(r){return r.children.map((function(r){return a(r,e)}))}},exports.defaultNodeTypes=n,exports.deserialize=a,exports.serialize=function e(a,i){void 0===i&&(i={nodeTypes:n});var l=i.nodeTypes,c=void 0===l?n:l,s=i.ignoreParagraphNewline,d=void 0!==s&&s,p=i.listDepth,h=void 0===p?0:p,g=a.text||"",y=a.type||"",v=t({},n,c,{heading:t({},n.heading,c.heading)}),f=[v.ul_list,v.ol_list],_=g;if(o(a)||(_=a.children.map((function(r){var n=!o(r)&&f.includes(r.type||""),i=f.includes(a.type||""),l=!1;return!o(a)&&Array.isArray(a.children)&&(l=a.children.some((function(e){return!o(e)&&e.type===v.link}))),e(t({},r,{parentType:y}),{nodeTypes:v,ignoreParagraphNewline:(d||n||i||l)&&!r.break,listDepth:f.includes(r.type||"")?h+1:h})})).join("")),d||""!==g&&"\n"!==g||a.parentType!==v.paragraph||(y=v.paragraph,_="<br>"),""!==_)switch("<br>"!==_&&o(a)&&(a.strikeThrough&&a.bold&&a.italic?_=u(_,"~~***"):a.bold&&a.italic?_=u(_,"***"):(a.bold&&(_=u(_,"**")),a.italic&&(_=u(_,"_")),a.strikeThrough&&(_=u(_,"~~")))),y){case v.heading[1]:return"# "+_+"\n";case v.heading[2]:return"## "+_+"\n";case v.heading[3]:return"### "+_+"\n";case v.heading[4]:return"#### "+_+"\n";case v.heading[5]:return"##### "+_+"\n";case v.heading[6]:return"###### "+_+"\n";case v.block_quote:return"> "+_+"\n\n";case v.code_block:return"```"+(a.language||"")+"\n"+_+"\n```\n";case v.link:return"["+_+"]("+(a.link||"")+")";case v.ul_list:case v.ol_list:return"\n"+_+"\n";case v.listItem:for(var k=a&&a.parentType===v.ol_list,b="",m=0;h>m;m++)b+=k?" ":" ";return b+(k?"1.":"-")+" "+_;case v.paragraph:return _+"\n";default:return r(_)}};
//# sourceMappingURL=remark-slate.cjs.production.min.js.map

@@ -36,6 +36,9 @@ import escapeHtml from 'escape-html';

6: 'heading_six'
}
},
emphasis_mark: 'italic',
strong_mark: 'bold',
delete_mark: 'strikeThrough'
};
function deserialize(node, opts) {
var _opts, _opts$nodeTypes, _node$value;
var _opts, _opts$nodeTypes, _node$value, _extends2, _extends3, _extends4;

@@ -127,3 +130,3 @@ if (opts === void 0) {

return {
type: 'parapgraph',
type: 'paragraph',
children: [{

@@ -135,15 +138,9 @@ text: ''

case 'emphasis':
return _extends({
italic: true
}, forceLeafNode(children), persistLeafFormats(children));
return _extends((_extends2 = {}, _extends2[types.emphasis_mark] = true, _extends2), forceLeafNode(children), persistLeafFormats(children));
case 'strong':
return _extends({
bold: true
}, forceLeafNode(children), persistLeafFormats(children));
return _extends((_extends3 = {}, _extends3[types.strong_mark] = true, _extends3), forceLeafNode(children), persistLeafFormats(children));
case 'delete':
return _extends({
strikeThrough: true
}, forceLeafNode(children), persistLeafFormats(children));
return _extends((_extends4 = {}, _extends4[types.delete_mark] = true, _extends4), forceLeafNode(children), persistLeafFormats(children));

@@ -150,0 +147,0 @@ case 'text':

{
"name": "remark-slate",
"version": "1.2.2",
"version": "1.3.0",
"description": "remark plugin to compile Markdown to a slate compatible object",
"license": "MIT",
"module": "dist/remark-slate-ts.esm.js",
"module": "dist/remark-slate.esm.js",
"scripts": {

@@ -46,4 +46,4 @@ "start": "tsdx watch",

"prettier": "^2.0.0",
"remark": "^11.0.0",
"remark-parse": "^8.0.2",
"remark": "^13.0.0",
"remark-parse": "^9.0.0",
"tsdx": "^0.13.2",

@@ -50,0 +50,0 @@ "tslib": "^2.0.0",

@@ -17,2 +17,5 @@ export interface NodeTypes {

};
emphasis_mark?: string;
strong_mark?: string;
delete_mark?: string;
}

@@ -56,2 +59,5 @@

},
emphasis_mark: 'italic',
strong_mark: 'bold',
delete_mark: 'strikeThrough',
};

@@ -120,7 +126,7 @@

// TODO: Handle other HTML?
return { type: 'parapgraph', children: [{ text: '' }] };
return { type: 'paragraph', children: [{ text: '' }] };
case 'emphasis':
return {
italic: true,
[types.emphasis_mark]: true,
...forceLeafNode(children),

@@ -131,3 +137,3 @@ ...persistLeafFormats(children),

return {
bold: true,
[types.strong_mark]: true,
...forceLeafNode(children),

@@ -138,3 +144,3 @@ ...persistLeafFormats(children),

return {
strikeThrough: true,
[types.delete_mark]: true,
...forceLeafNode(children),

@@ -141,0 +147,0 @@ ...persistLeafFormats(children),

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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