@bangle.dev/markdown
Advanced tools
Comparing version
@@ -11,2 +11,4 @@ export { default as StateCore } from 'markdown-it/lib/rules_core/state_core'; | ||
markup: string; | ||
whiteSpaceBefore?: boolean; | ||
whiteSpaceAfter?: boolean; | ||
}; | ||
@@ -13,0 +15,0 @@ /** |
@@ -55,8 +55,18 @@ import markdownIt from 'markdown-it'; | ||
const offset = args[args.length - 2]; | ||
let { payload, markup } = getTokenDetails(match, offset, text); | ||
let { payload, markup, whiteSpaceAfter, whiteSpaceBefore } = getTokenDetails(match, offset, text); | ||
// Add new tokens to pending list | ||
if (offset > last_pos) { | ||
if (whiteSpaceBefore) { | ||
let wToken = new Token('text', '', 0); | ||
wToken.content = ' '; | ||
nodes.push(wToken); | ||
} | ||
token = new Token('text', '', 0); | ||
token.content = text.slice(last_pos, offset); | ||
nodes.push(token); | ||
if (whiteSpaceAfter) { | ||
let wToken = new Token('text', '', 0); | ||
wToken.content = ' '; | ||
nodes.push(wToken); | ||
} | ||
} | ||
@@ -63,0 +73,0 @@ token = new Token(tokenName, '', 0); |
{ | ||
"name": "@bangle.dev/markdown", | ||
"version": "0.31.4", | ||
"version": "0.31.5", | ||
"homepage": "https://bangle.dev", | ||
@@ -28,3 +28,3 @@ "authors": [ | ||
"dependencies": { | ||
"@bangle.dev/utils": "0.31.4", | ||
"@bangle.dev/utils": "0.31.5", | ||
"@types/jest": "^27.5.2", | ||
@@ -39,7 +39,7 @@ "markdown-it": "^10.0.0", | ||
"devDependencies": { | ||
"@bangle.dev/base-components": "0.31.4", | ||
"@bangle.dev/core": "0.31.4", | ||
"@bangle.dev/pm": "0.31.4", | ||
"@bangle.dev/table": "0.31.4", | ||
"@bangle.dev/test-helpers": "0.31.4", | ||
"@bangle.dev/base-components": "0.31.5", | ||
"@bangle.dev/core": "0.31.5", | ||
"@bangle.dev/pm": "0.31.5", | ||
"@bangle.dev/table": "0.31.5", | ||
"@bangle.dev/test-helpers": "0.31.5", | ||
"@types/markdown-it": "^12.2.3" | ||
@@ -46,0 +46,0 @@ }, |
@@ -9,3 +9,12 @@ import StateCore from 'markdown-it/lib/rules_core/state_core'; | ||
srcText: string, | ||
) => { payload: string; markup: string }; | ||
) => { | ||
// TODO document what markup and payload is. `markup` is used by markdown-it and `payload` seems | ||
// to be a bangle thing consumed by bangle only. Are they the same thing? If yes, we should dedupe. | ||
payload: string; | ||
markup: string; | ||
// Tell whether to insert a space before this token | ||
whiteSpaceBefore?: boolean; | ||
// Tell whether to insert a space after this token | ||
whiteSpaceAfter?: boolean; | ||
}; | ||
@@ -101,9 +110,22 @@ /** | ||
const offset = args[args.length - 2]; | ||
let { payload, markup } = getTokenDetails(match, offset, text); | ||
let { payload, markup, whiteSpaceAfter, whiteSpaceBefore } = | ||
getTokenDetails(match, offset, text); | ||
// Add new tokens to pending list | ||
if (offset > last_pos) { | ||
if (whiteSpaceBefore) { | ||
let wToken = new Token('text', '', 0); | ||
wToken.content = ' '; | ||
nodes.push(wToken); | ||
} | ||
token = new Token('text', '', 0); | ||
token.content = text.slice(last_pos, offset); | ||
nodes.push(token); | ||
if (whiteSpaceAfter) { | ||
let wToken = new Token('text', '', 0); | ||
wToken.content = ' '; | ||
nodes.push(wToken); | ||
} | ||
} | ||
@@ -110,0 +132,0 @@ |
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
151728
1.1%2890
1.47%+ Added
- Removed
Updated