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.0.0 to 1.0.1

15

dist/deserialize.d.ts

@@ -55,2 +55,3 @@ export interface NodeTypes {

link?: undefined;
break?: undefined;
text?: undefined;

@@ -63,7 +64,17 @@ } | {

}[];
break?: undefined;
text?: undefined;
} | {
break: boolean;
type: string;
children: {
text: string;
}[];
link?: undefined;
text?: undefined;
} | {
type?: undefined;
children?: undefined;
link?: undefined;
break?: undefined;
text?: undefined;

@@ -84,2 +95,3 @@ } | {

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

@@ -99,2 +111,3 @@ type?: string | undefined;

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

@@ -114,2 +127,3 @@ type?: string | undefined;

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

@@ -120,2 +134,3 @@ text: string;

link?: undefined;
break?: undefined;
};

19

dist/remark-slate.cjs.development.js

@@ -106,2 +106,3 @@ 'use strict';

return {
"break": true,
type: types.paragraph,

@@ -194,3 +195,14 @@ children: [{

var isList = !isLeafNode(c) ? LIST_TYPES.includes(c.type || '') : false;
var selfIsList = LIST_TYPES.includes(chunk.type || '');
var selfIsList = LIST_TYPES.includes(chunk.type || ''); // Links can have the following shape
// In which case we don't want to surround
// with break tags
// {
// type: 'paragraph',
// children: [
// { text: '' },
// { type: 'link', children: [{ text: foo.com }]}
// { text: '' }
// ]
// }
var childrenHasLink = false;

@@ -215,3 +227,4 @@

// to respect neighboring paragraphs
ignoreParagraphNewline: ignoreParagraphNewline || isList || selfIsList || childrenHasLink,
ignoreParagraphNewline: (ignoreParagraphNewline || isList || selfIsList || childrenHasLink) && // if we have c.break, never ignore empty paragraph new line
!c["break"],
// track depth of nested lists so we can add proper spacing

@@ -224,3 +237,3 @@ listDepth: LIST_TYPES.includes(c.type || '') ? listDepth + 1 : listDepth

if (!ignoreParagraphNewline && text === '' && chunk.parentType === nodeTypes.paragraph) {
if (!ignoreParagraphNewline && (text === '' || text === '\n') && chunk.parentType === nodeTypes.paragraph) {
type = 'paragraph';

@@ -227,0 +240,0 @@ children = BREAK_TAG;

2

dist/remark-slate.cjs.production.min.js

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

"use strict";function e(){return(e=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)}Object.defineProperty(exports,"__esModule",{value:!0});var r={paragraph:"paragraph",block_quote:"block_quote",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 t(a,l){var u,o;void 0===l&&(l={nodeTypes:{}});var s=e({},r,l.nodeTypes,{heading:e({},r.heading,null===(u=l)||void 0===u||null===(o=u.nodeTypes)||void 0===o?void 0:o.heading)}),c=[{text:""}];switch(a.children&&Array.isArray(a.children)&&a.children.length>0&&(c=a.children.map((function(r){return t(e({},r,{ordered:a.ordered||!1}),l)}))),a.type){case"heading":return{type:s.heading[a.depth||1],children:c};case"list":return{type:a.ordered?s.ol_list:s.ul_list,children:c};case"listItem":return{type:s.listItem,children:c};case"paragraph":return{type:s.paragraph,children:c};case"link":return{type:s.link,link:a.url,children:c};case"blockquote":return{type:s.block_quote,children:c};case"html":return"<br>"===a.value?{type:s.paragraph,children:[{text:""}]}:{};case"emphasis":return e({italic:!0},n(c),i(c));case"strong":return e({bold:!0},n(c),i(c));case"delete":return e({strikeThrough:!0},n(c),i(c));case"text":default:return{text:a.value||""}}}var n=function(e){return{text:e.map((function(e){return null==e?void 0:e.text})).join("")}};function i(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 a=function(e){return"string"==typeof e.text};function l(e,r){var t=e.trim();return t.length===e.length?""+r+t+r:e.replace(t,r+t+r)}exports.default=function(e){this.Compiler=function(r){return r.children.map((function(r){return t(r,e)}))}},exports.defaultNodeTypes=r,exports.deserialize=t,exports.serialize=function t(n,i){void 0===i&&(i={nodeTypes:r});var u=i.nodeTypes,o=void 0===u?r:u,s=i.ignoreParagraphNewline,c=void 0!==s&&s,d=i.listDepth,h=void 0===d?0:d,p=n.text||"",g=n.type||"",y=e({},r,o,{heading:e({},r.heading,o.heading)}),f=[y.ul_list,y.ol_list],v=p;if(a(n)||(v=n.children.map((function(r){var i=!a(r)&&f.includes(r.type||""),l=f.includes(n.type||""),u=!1;return!a(n)&&Array.isArray(n.children)&&(u=n.children.some((function(e){return!a(e)&&"link"===e.type}))),t(e({},r,{parentType:g}),{nodeTypes:y,ignoreParagraphNewline:c||i||l||u,listDepth:f.includes(r.type||"")?h+1:h})})).join("")),c||""!==p||n.parentType!==y.paragraph||(g="paragraph",v="<br>"),""!==v)switch("<br>"!==v&&a(n)&&(n.bold&&n.italic?v=l(v,"***"):(n.bold&&(v=l(v,"**")),n.italic&&(v=l(v,"_"))),n.strikeThrough&&(v="~~"+v+"~~")),g){case y.heading[1]:return"# "+v+"\n";case y.heading[2]:return"## "+v+"\n";case y.heading[3]:return"### "+v+"\n";case y.heading[4]:return"#### "+v+"\n";case y.heading[5]:return"##### "+v+"\n";case y.heading[6]:return"###### "+v+"\n";case y.block_quote:return"> "+v+"\n\n";case y.link:return"["+v+"]("+(n.link||"")+")";case y.ul_list:case y.ol_list:return"\n"+v+"\n";case y.listItem:for(var _=n&&"ol_list"===n.parentType,k="",b=0;h>b;b++)k+=_?" ":" ";return k+(_?"1.":"-")+" "+v;case y.paragraph:return v+"\n";default:return v}};
"use strict";function e(){return(e=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)}Object.defineProperty(exports,"__esModule",{value:!0});var r={paragraph:"paragraph",block_quote:"block_quote",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 t(a,l){var u,o;void 0===l&&(l={nodeTypes:{}});var s=e({},r,l.nodeTypes,{heading:e({},r.heading,null===(u=l)||void 0===u||null===(o=u.nodeTypes)||void 0===o?void 0:o.heading)}),c=[{text:""}];switch(a.children&&Array.isArray(a.children)&&a.children.length>0&&(c=a.children.map((function(r){return t(e({},r,{ordered:a.ordered||!1}),l)}))),a.type){case"heading":return{type:s.heading[a.depth||1],children:c};case"list":return{type:a.ordered?s.ol_list:s.ul_list,children:c};case"listItem":return{type:s.listItem,children:c};case"paragraph":return{type:s.paragraph,children:c};case"link":return{type:s.link,link:a.url,children:c};case"blockquote":return{type:s.block_quote,children:c};case"html":return"<br>"===a.value?{break:!0,type:s.paragraph,children:[{text:""}]}:{};case"emphasis":return e({italic:!0},n(c),i(c));case"strong":return e({bold:!0},n(c),i(c));case"delete":return e({strikeThrough:!0},n(c),i(c));case"text":default:return{text:a.value||""}}}var n=function(e){return{text:e.map((function(e){return null==e?void 0:e.text})).join("")}};function i(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 a=function(e){return"string"==typeof e.text};function l(e,r){var t=e.trim();return t.length===e.length?""+r+t+r:e.replace(t,r+t+r)}exports.default=function(e){this.Compiler=function(r){return r.children.map((function(r){return t(r,e)}))}},exports.defaultNodeTypes=r,exports.deserialize=t,exports.serialize=function t(n,i){void 0===i&&(i={nodeTypes:r});var u=i.nodeTypes,o=void 0===u?r:u,s=i.ignoreParagraphNewline,c=void 0!==s&&s,d=i.listDepth,h=void 0===d?0:d,p=n.text||"",g=n.type||"",y=e({},r,o,{heading:e({},r.heading,o.heading)}),f=[y.ul_list,y.ol_list],v=p;if(a(n)||(v=n.children.map((function(r){var i=!a(r)&&f.includes(r.type||""),l=f.includes(n.type||""),u=!1;return!a(n)&&Array.isArray(n.children)&&(u=n.children.some((function(e){return!a(e)&&"link"===e.type}))),t(e({},r,{parentType:g}),{nodeTypes:y,ignoreParagraphNewline:(c||i||l||u)&&!r.break,listDepth:f.includes(r.type||"")?h+1:h})})).join("")),c||""!==p&&"\n"!==p||n.parentType!==y.paragraph||(g="paragraph",v="<br>"),""!==v)switch("<br>"!==v&&a(n)&&(n.bold&&n.italic?v=l(v,"***"):(n.bold&&(v=l(v,"**")),n.italic&&(v=l(v,"_"))),n.strikeThrough&&(v="~~"+v+"~~")),g){case y.heading[1]:return"# "+v+"\n";case y.heading[2]:return"## "+v+"\n";case y.heading[3]:return"### "+v+"\n";case y.heading[4]:return"#### "+v+"\n";case y.heading[5]:return"##### "+v+"\n";case y.heading[6]:return"###### "+v+"\n";case y.block_quote:return"> "+v+"\n\n";case y.link:return"["+v+"]("+(n.link||"")+")";case y.ul_list:case y.ol_list:return"\n"+v+"\n";case y.listItem:for(var _=n&&"ol_list"===n.parentType,k="",b=0;h>b;b++)k+=_?" ":" ";return k+(_?"1.":"-")+" "+v;case y.paragraph:return v+"\n";default:return v}};
//# sourceMappingURL=remark-slate.cjs.production.min.js.map

@@ -102,2 +102,3 @@ function _extends() {

return {
"break": true,
type: types.paragraph,

@@ -190,3 +191,14 @@ children: [{

var isList = !isLeafNode(c) ? LIST_TYPES.includes(c.type || '') : false;
var selfIsList = LIST_TYPES.includes(chunk.type || '');
var selfIsList = LIST_TYPES.includes(chunk.type || ''); // Links can have the following shape
// In which case we don't want to surround
// with break tags
// {
// type: 'paragraph',
// children: [
// { text: '' },
// { type: 'link', children: [{ text: foo.com }]}
// { text: '' }
// ]
// }
var childrenHasLink = false;

@@ -211,3 +223,4 @@

// to respect neighboring paragraphs
ignoreParagraphNewline: ignoreParagraphNewline || isList || selfIsList || childrenHasLink,
ignoreParagraphNewline: (ignoreParagraphNewline || isList || selfIsList || childrenHasLink) && // if we have c.break, never ignore empty paragraph new line
!c["break"],
// track depth of nested lists so we can add proper spacing

@@ -220,3 +233,3 @@ listDepth: LIST_TYPES.includes(c.type || '') ? listDepth + 1 : listDepth

if (!ignoreParagraphNewline && text === '' && chunk.parentType === nodeTypes.paragraph) {
if (!ignoreParagraphNewline && (text === '' || text === '\n') && chunk.parentType === nodeTypes.paragraph) {
type = 'paragraph';

@@ -223,0 +236,0 @@ children = BREAK_TAG;

import { NodeTypes } from './deserialize';
interface LeafType {
export interface LeafType {
text: string;

@@ -9,6 +9,7 @@ strikeThrough?: boolean;

}
interface BlockType {
export interface BlockType {
type: string;
parentType?: string;
link?: string;
break?: boolean;
children: Array<BlockType | LeafType>;

@@ -15,0 +16,0 @@ }

{
"name": "remark-slate",
"version": "1.0.0",
"version": "1.0.1",
"description": "remark plugin to compile Markdown to a slate compatible object",

@@ -44,5 +44,7 @@ "license": "MIT",

"remark": "^11.0.0",
"remark-parse": "^8.0.2",
"tsdx": "^0.13.2",
"tslib": "^2.0.0",
"typescript": "^3.9.3"
"typescript": "^3.9.3",
"unified": "^9.0.0"
},

@@ -49,0 +51,0 @@ "prettier": {

@@ -103,2 +103,3 @@ export interface NodeTypes {

return {
break: true,
type: types.paragraph,

@@ -105,0 +106,0 @@ children: [{ text: '' }],

import { defaultNodeTypes, NodeTypes } from './deserialize';
interface LeafType {
export interface LeafType {
text: string;

@@ -11,6 +11,7 @@ strikeThrough?: boolean;

interface BlockType {
export interface BlockType {
type: string;
parentType?: string;
link?: string;
break?: boolean;
children: Array<BlockType | LeafType>;

@@ -66,2 +67,13 @@ }

// Links can have the following shape
// In which case we don't want to surround
// with break tags
// {
// type: 'paragraph',
// children: [
// { text: '' },
// { type: 'link', children: [{ text: foo.com }]}
// { text: '' }
// ]
// }
let childrenHasLink = false;

@@ -87,3 +99,8 @@

ignoreParagraphNewline:
ignoreParagraphNewline || isList || selfIsList || childrenHasLink,
(ignoreParagraphNewline ||
isList ||
selfIsList ||
childrenHasLink) &&
// if we have c.break, never ignore empty paragraph new line
!(c as BlockType).break,

@@ -103,3 +120,3 @@ // track depth of nested lists so we can add proper spacing

!ignoreParagraphNewline &&
text === '' &&
(text === '' || text === '\n') &&
chunk.parentType === nodeTypes.paragraph

@@ -106,0 +123,0 @@ ) {

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