sugar-high
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -183,9 +183,14 @@ // @ts-check | ||
/** @returns {0|1|2} */ | ||
function isCommentStart_Js(curr, next) { | ||
const str = curr + next | ||
return str === '//' || str === '/*' | ||
if (str === '/*') return 2 | ||
return str === '//' ? 1 : 0 | ||
} | ||
/** @returns {0|1|2} */ | ||
function isCommentEnd_Js(prev, curr) { | ||
return curr === '\n' || (prev + curr) === '*/' | ||
return (prev + curr) === '*/' | ||
? 2 | ||
: curr === '\n' ? 1 : 0 | ||
} | ||
@@ -474,5 +479,15 @@ | ||
append(T_PROPERTY) | ||
} else if (prop === ' ') { | ||
current = prop | ||
append(T_SPACE) | ||
} | ||
continue | ||
} | ||
// if (curr === ' ' || isSign(curr)) { | ||
// append() | ||
// current = curr | ||
// append() | ||
// continue | ||
// } | ||
} | ||
@@ -560,3 +575,3 @@ } | ||
const start = i | ||
const commentType = onCommentStart(curr, next) | ||
const startCommentType = onCommentStart(curr, next) | ||
@@ -566,4 +581,7 @@ // just match the comment, commentType === true | ||
// block comment, commentType === 2 | ||
if (commentType) { | ||
for (; i < code.length && !onCommentEnd(code[i - 1], code[i]); i++); | ||
if (startCommentType) { | ||
for (; i < code.length; i++) { | ||
const endCommentType = onCommentEnd(code[i - 1], code[i]) | ||
if (endCommentType == startCommentType) break | ||
} | ||
} | ||
@@ -570,0 +588,0 @@ current = code.slice(start, i + 1) |
{ | ||
"name": "sugar-high", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"type": "module", | ||
@@ -21,10 +21,13 @@ "types": "./lib/index.d.ts", | ||
"devDependencies": { | ||
"codice": "^0.2.0", | ||
"next": "15.1.3", | ||
"@types/node": "22.10.7", | ||
"@types/react": "19.0.7", | ||
"codice": "^0.4.2", | ||
"next": "15.1.5", | ||
"react": "^19.0.0", | ||
"react-dom": "^19.0.0", | ||
"sugar-high": "link:./", | ||
"vitest": "^2.1.3" | ||
"typescript": "5.7.3", | ||
"vitest": "^3.0.2" | ||
}, | ||
"packageManager": "pnpm@8.7.1" | ||
} |
@@ -99,2 +99,8 @@ # Sugar High | ||
### Use With Remark.js | ||
[Remark.js](https://remark.js.org/) is a powerful markdown processor, you can use the [sugar-high remark plugin](https://remark-sugar-high.vercel.app/) with remark.js to highlight code blocks in markdown. | ||
Check out the [documentation](https://remark-sugar-high.vercel.app/) for more details. | ||
### LICENSE | ||
@@ -101,0 +107,0 @@ |
21229
709
122
9