Skip to content

Commit 88fdecf

Browse files
committed
lint:fix
1 parent 1f230ab commit 88fdecf

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

packages/repl-sdk/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
"type": "addon"
2323
},
2424
"scripts": {
25-
"lint:fix": "pnpm -w exec lint fix",
25+
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\" --prefixColors auto",
26+
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\" --prefixColors auto && pnpm run format",
2627
"example": "cd example && vite",
2728
"lint:package": "pnpm publint",
2829
"lint:js": "pnpm -w exec lint js",
2930
"lint:types": "tsc --noEmit",
3031
"lint:js:fix": "pnpm -w exec lint js:fix",
31-
"lint:prettier:fix": "pnpm -w exec lint prettier:fix",
32+
"format": "pnpm -w exec lint prettier:fix",
3233
"lint:prettier": "pnpm -w exec lint prettier",
3334
"test:node": "vitest"
3435
},

packages/repl-sdk/src/compilers/markdown/parse.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,15 @@ function unescapeComponentsOutsideCode(html) {
6565
// Only touch content outside <pre>
6666
if (i % 2 === 0) {
6767
// Split by <code>…</code> so we skip inline code too
68-
const codeParts = parts[i].split(/(<code[^>]*>[\s\S]*?<\/code>)/gi);
68+
const part = parts[i] ?? '';
69+
const codeParts = part.split(/(<code[^>]*>[\s\S]*?<\/code>)/gi);
6970

7071
for (let j = 0; j < codeParts.length; j++) {
72+
const segment = codeParts[j];
73+
7174
// Even indices are outside <code> – unescape PascalCase there
72-
if (j % 2 === 0) {
73-
codeParts[j] = codeParts[j]
75+
if (j % 2 === 0 && segment) {
76+
codeParts[j] = segment
7477
.replace(/&#x3C;([A-Z][a-zA-Z0-9]*\s[^<]*?)>/g, (_m, content) =>
7578
content.includes('@') ? `<${content}>` : _m
7679
)

packages/repl-sdk/src/remark-escape-components.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ export const REPL_LT = '__REPL_LT__';
1111
/**
1212
* Remark plugin: escape PascalCase component tags in `inlineCode` and
1313
* non-live `code` (code fence) nodes by replacing `<` with a placeholder.
14-
*
15-
* @returns {import('unified').Plugin}
1614
*/
1715
function remarkEscapeComponents() {
16+
/** @param {import('mdast').Root} tree */
1817
return (tree) => {
1918
visit(tree, (node) => {
2019
// Inline code (backticks)
@@ -23,6 +22,7 @@ function remarkEscapeComponents() {
2322
.replace(/<([A-Z][a-zA-Z0-9]*(?:\s[^<]*)?)>/g, REPL_LT + '$1>')
2423
.replace(/<\/([A-Z][a-zA-Z0-9]*)>/g, REPL_LT + '/$1>');
2524
}
25+
2626
// Code fences (``` blocks)
2727
if (node.type === 'code') {
2828
// Only escape if not live

0 commit comments

Comments
 (0)