@vuepress/plugin-shiki 2.0.0-rc.36 → 2.0.0-rc.38

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.
@@ -1,2 +1,2 @@
1
1
  import type { MarkdownFilePathGetter } from './createMarkdownFilePathGetter.js';
2
- export declare const getLanguage: (lang: string, loadedLanguages: string[], defaultLang: string, logLevel: string, getMarkdownFilePath: MarkdownFilePathGetter) => string;
2
+ export declare const getLanguage: (lang: string, loadedLanguages: string[], defaultLang: string | undefined, logLevel: string, getMarkdownFilePath: MarkdownFilePathGetter) => string;
@@ -7,14 +7,14 @@ export const getLanguage = (lang, loadedLanguages, defaultLang, logLevel, getMar
7
7
  if (result && !loadedLanguages.includes(result) && !isSpecialLang(result)) {
8
8
  // warn for unknown languages only once
9
9
  if (logLevel !== 'silent' && !WARNED_LANGS.has(result)) {
10
- logger.warn(`Missing ${colors.cyan(lang)} highlighter, use ${colors.cyan(defaultLang)} to highlight instead.`);
10
+ logger.warn(`Missing ${colors.cyan(lang)} highlighter, ${defaultLang ? `use ${colors.cyan(defaultLang)} to highlight instead.` : 'skip highlighting'}`);
11
11
  WARNED_LANGS.add(result);
12
12
  }
13
13
  // log file path if unknown language is found
14
14
  if (logLevel === 'debug') {
15
15
  logger.info(`Unknown language ${colors.cyan(result)} found in ${colors.cyan(getMarkdownFilePath())}`);
16
16
  }
17
- result = defaultLang;
17
+ result = defaultLang || 'plain';
18
18
  }
19
19
  return result;
20
20
  };
@@ -1,15 +1,15 @@
1
1
  import { transformerCompactLineOptions } from '@shikijs/transformers';
2
- import { getHighlighter } from 'shiki';
2
+ import { createHighlighter } from 'shiki';
3
3
  import { bundledLanguageNames } from '../../shiki.js';
4
4
  import { getTransformers, whitespaceTransformer, } from '../../transformers/getTransformers.js';
5
5
  import { attrsToLines } from '../../utils.js';
6
6
  import { createMarkdownFilePathGetter } from './createMarkdownFilePathGetter.js';
7
7
  import { getLanguage } from './getLanguage.js';
8
8
  import { handleMustache } from './handleMustache.js';
9
- export const applyHighlighter = async (md, app, { langs = bundledLanguageNames, langAlias = {}, defaultLang = 'plain', transformers: userTransformers = [], ...options } = {}) => {
9
+ export const applyHighlighter = async (md, app, { langs = bundledLanguageNames, langAlias = {}, defaultLang, transformers: userTransformers = [], ...options } = {}) => {
10
10
  const logLevel = options.logLevel ?? (app.env.isDebug ? 'debug' : 'warn');
11
11
  const getMarkdownFilePath = logLevel === 'debug' ? createMarkdownFilePathGetter(md) : null;
12
- const highlighter = await getHighlighter({
12
+ const highlighter = await createHighlighter({
13
13
  langs,
14
14
  langAlias,
15
15
  themes: 'themes' in options
@@ -30,7 +30,7 @@ export const applyHighlighter = async (md, app, { langs = bundledLanguageNames,
30
30
  },
31
31
  transformers: [
32
32
  ...transformers,
33
- ...(options.highlightLines ?? true
33
+ ...((options.highlightLines ?? true)
34
34
  ? [transformerCompactLineOptions(attrsToLines(attrs))]
35
35
  : []),
36
36
  ...whitespaceTransformer(attrs, options.whitespace),
@@ -2,7 +2,7 @@ import type { TransformerCompactLineOption } from '@shikijs/transformers';
2
2
  import { Logger } from '@vuepress/helper';
3
3
  export declare const PLUGIN_NAME = "@vuepress/plugin-shiki";
4
4
  export declare const logger: Logger;
5
- export declare const nanoid: (size?: number | undefined) => string;
5
+ export declare const nanoid: (size?: number) => string;
6
6
  export declare const resolveLanguage: (info: string) => string;
7
7
  export declare const resolveAttr: (info: string, attr: string) => string | null;
8
8
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/plugin-shiki",
3
- "version": "2.0.0-rc.36",
3
+ "version": "2.0.0-rc.38",
4
4
  "description": "VuePress plugin - shiki",
5
5
  "keywords": [
6
6
  "vuepress-plugin",
@@ -31,17 +31,17 @@
31
31
  "lib"
32
32
  ],
33
33
  "dependencies": {
34
- "@shikijs/transformers": "^1.7.0",
35
- "@vuepress/helper": "2.0.0-rc.36",
36
- "@vuepress/highlighter-helper": "2.0.0-rc.36",
34
+ "@shikijs/transformers": "^1.10.3",
35
+ "@vuepress/helper": "2.0.0-rc.38",
36
+ "@vuepress/highlighter-helper": "2.0.0-rc.37",
37
37
  "nanoid": "^5.0.7",
38
- "shiki": "^1.7.0"
38
+ "shiki": "^1.10.3"
39
39
  },
40
40
  "peerDependencies": {
41
- "vuepress": "2.0.0-rc.13"
41
+ "vuepress": "2.0.0-rc.14"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "7f283f7243f9f9b86a9621f6ebc00d8d335d5f94"
46
+ "gitHead": "4345344b92c788c8f0c4a78b2cd022bc31ef5108"
47
47
  }