@shikijs/core 3.6.0 → 3.7.0

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.
Files changed (2) hide show
  1. package/dist/index.mjs +3 -1
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -118,6 +118,7 @@ function guessEmbeddedLanguages(code, _lang, highlighter) {
118
118
  }
119
119
 
120
120
  const DEFAULT_COLOR_LIGHT_DARK = "light-dark()";
121
+ const COLOR_KEYS = ["color", "background-color"];
121
122
 
122
123
  function splitToken(token, offsets) {
123
124
  let lastOffset = 0;
@@ -170,7 +171,7 @@ function flatTokenVariants(merged, variantsOrder, cssVariablePrefix, defaultColo
170
171
  styles.forEach((cur, idx) => {
171
172
  for (const key of styleKeys) {
172
173
  const value = cur[key] || "inherit";
173
- if (idx === 0 && defaultColor) {
174
+ if (idx === 0 && defaultColor && COLOR_KEYS.includes(key)) {
174
175
  if (defaultColor === DEFAULT_COLOR_LIGHT_DARK && styles.length > 1) {
175
176
  const lightIndex = variantsOrder.findIndex((t) => t === "light");
176
177
  const darkIndex = variantsOrder.findIndex((t) => t === "dark");
@@ -1952,6 +1953,7 @@ function createdBundledHighlighter(options) {
1952
1953
  if (typeof lang === "string") {
1953
1954
  if (isSpecialLang(lang))
1954
1955
  return [];
1956
+ lang = options2.langAlias?.[lang] || lang;
1955
1957
  const bundle = bundledLanguages[lang];
1956
1958
  if (!bundle)
1957
1959
  throw new ShikiError$1(`Language \`${lang}\` is not included in this bundle. You may want to load it from external source.`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/core",
3
3
  "type": "module",
4
- "version": "3.6.0",
4
+ "version": "3.7.0",
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.6.0"
42
+ "@shikijs/types": "3.7.0"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "unbuild",