@shikijs/core 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -272,4 +272,5 @@ declare function enableDeprecationWarnings(emitDeprecation?: DeprecationTarget |
272
272
  */
273
273
  declare function warnDeprecated(message: string, version?: DeprecationTarget): void;
274
274
 
275
- export { type CreateSingletonShorthandsOptions, type CssVariablesThemeOptions, type ShorthandsBundle, addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync, createPositionConverter, createShikiInternal, createShikiInternalSync, createSingletonShorthands, createdBundledHighlighter, enableDeprecationWarnings, flatTokenVariants, getSingletonHighlighterCore, getTokenStyleObject, guessEmbeddedLanguages, hastToHtml, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated };
275
+ export { addClassToHast, applyColorReplacements, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createCssVariablesTheme, createHighlighterCore, createHighlighterCoreSync, createPositionConverter, createShikiInternal, createShikiInternalSync, createSingletonShorthands, createdBundledHighlighter, enableDeprecationWarnings, flatTokenVariants, getSingletonHighlighterCore, getTokenStyleObject, guessEmbeddedLanguages, hastToHtml, isNoneTheme, isPlainLang, isSpecialLang, isSpecialTheme, makeSingletonHighlighter, makeSingletonHighlighterCore, normalizeGetter, normalizeTheme, resolveColorReplacements, splitLines, splitToken, splitTokens, stringifyTokenStyle, toArray, tokenizeAnsiWithTheme, tokenizeWithTheme, tokensToHast, transformerDecorations, warnDeprecated };
276
+ export type { CreateSingletonShorthandsOptions, CssVariablesThemeOptions, ShorthandsBundle };
package/dist/index.mjs CHANGED
@@ -187,8 +187,13 @@ function getTokenStyleObject(token) {
187
187
  styles["font-style"] = "italic";
188
188
  if (token.fontStyle & FontStyle.Bold)
189
189
  styles["font-weight"] = "bold";
190
+ const decorations = [];
190
191
  if (token.fontStyle & FontStyle.Underline)
191
- styles["text-decoration"] = "underline";
192
+ decorations.push("underline");
193
+ if (token.fontStyle & FontStyle.Strikethrough)
194
+ decorations.push("line-through");
195
+ if (decorations.length)
196
+ styles["text-decoration"] = decorations.join(" ");
192
197
  }
193
198
  return styles;
194
199
  }
@@ -760,6 +765,8 @@ function tokenizeAnsiWithTheme(theme, fileContents, options) {
760
765
  fontStyle |= FontStyle.Italic;
761
766
  if (token.decorations.has("underline"))
762
767
  fontStyle |= FontStyle.Underline;
768
+ if (token.decorations.has("strikethrough"))
769
+ fontStyle |= FontStyle.Strikethrough;
763
770
  return {
764
771
  content: token.value,
765
772
  offset: line[1],
@@ -1310,8 +1317,8 @@ function mergeWhitespaceTokens(tokens) {
1310
1317
  let carryOnContent = "";
1311
1318
  let firstOffset = 0;
1312
1319
  line.forEach((token, idx) => {
1313
- const isUnderline = token.fontStyle && token.fontStyle & FontStyle.Underline;
1314
- const couldMerge = !isUnderline;
1320
+ const isDecorated = token.fontStyle && (token.fontStyle & FontStyle.Underline || token.fontStyle & FontStyle.Strikethrough);
1321
+ const couldMerge = !isDecorated;
1315
1322
  if (couldMerge && token.content.match(/^\s+$/) && line[idx + 1]) {
1316
1323
  if (!firstOffset)
1317
1324
  firstOffset = token.offset;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/core",
3
3
  "type": "module",
4
- "version": "3.2.0",
4
+ "version": "3.2.2",
5
5
  "description": "Core of Shiki",
6
6
  "author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "@shikijs/vscode-textmate": "^10.0.2",
40
40
  "@types/hast": "^3.0.4",
41
41
  "hast-util-to-html": "^9.0.5",
42
- "@shikijs/types": "3.2.0"
42
+ "@shikijs/types": "3.2.2"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "unbuild",