@rspress/shared 0.0.0-nightly-20231112160224 → 0.0.0-nightly-20231114160228

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.ts CHANGED
@@ -513,6 +513,7 @@ interface SiteData<ThemeConfig = NormalizedConfig> {
513
513
  markdown: {
514
514
  showLineNumbers: boolean;
515
515
  defaultWrapCode: boolean;
516
+ codeHighlighter: 'prism' | 'shiki';
516
517
  };
517
518
  multiVersion: {
518
519
  default: string;
@@ -646,6 +647,10 @@ interface MarkdownOptions {
646
647
  * Register global components in mdx files
647
648
  */
648
649
  globalComponents?: string[];
650
+ /**
651
+ * Code highlighter, default is prism for performance reason
652
+ */
653
+ codeHighlighter?: 'prism' | 'shiki';
649
654
  /**
650
655
  * Register prism languages
651
656
  */
@@ -667,6 +672,7 @@ declare const MDX_REGEXP: RegExp;
667
672
  declare const APPEARANCE_KEY = "rspress-theme-appearance";
668
673
  declare const SEARCH_INDEX_NAME = "search_index";
669
674
  declare const RSPRESS_TEMP_DIR = ".rspress";
675
+ declare const DEFAULT_HIGHLIGHT_LANGUAGES: (string | string[])[];
670
676
  declare const isSCM: () => boolean;
671
677
  declare const isProduction: () => boolean;
672
678
  declare const isDebugMode: () => boolean;
@@ -709,4 +715,4 @@ declare function removeBase(url: string, base: string): string;
709
715
  declare function withoutHash(url: string): string;
710
716
  declare const mergeDocConfig: (...configs: UserConfig[]) => UserConfig;
711
717
 
712
- export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, Nav, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedConfig, NormalizedConfig as NormalizedDefaultThemeConfig, NormalizedLocales, NormalizedSidebar, NormalizedSidebarGroup, PageData, PageIndexInfo, PageModule, PageType, RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, RemotePageInfo, RemoteSearchIndexInfo, RemoteSearchOptions, ReplaceRule, Route, RouteMeta, RouteOptions, RspressPlugin, SEARCH_INDEX_NAME, SearchHooks, SearchOptions, Sidebar, SidebarDivider, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, addTrailingSlash, cleanUrl, inBrowser, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutHash, withoutLang };
718
+ export { APPEARANCE_KEY, AdditionalPage, BaseRuntimePageInfo, Config, DEFAULT_HIGHLIGHT_LANGUAGES, Config$1 as DefaultThemeConfig, DocFooter, EditLink, Feature, Footer, FrontMatterMeta, HASH_REGEXP, Header, Hero, Image, LocalSearchOptions, Locale, LocaleConfig, LocaleLink, LocaleLinks, MDX_REGEXP, MarkdownOptions, Nav, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedConfig, NormalizedConfig as NormalizedDefaultThemeConfig, NormalizedLocales, NormalizedSidebar, NormalizedSidebarGroup, PageData, PageIndexInfo, PageModule, PageType, RspressPlugin as Plugin, QUERY_REGEXP, RSPRESS_TEMP_DIR, RemotePageInfo, RemoteSearchIndexInfo, RemoteSearchOptions, ReplaceRule, Route, RouteMeta, RouteOptions, RspressPlugin, SEARCH_INDEX_NAME, SearchHooks, SearchOptions, Sidebar, SidebarDivider, SidebarGroup, SidebarItem, SiteData, SocialLink, SocialLinkIcon, UserConfig, addLeadingSlash, addTrailingSlash, cleanUrl, inBrowser, isDebugMode, isExternalUrl, isProduction, isSCM, mergeDocConfig, normalizeHref, normalizePosixPath, normalizeSlash, omit, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutHash, withoutLang };
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
23
  APPEARANCE_KEY: () => APPEARANCE_KEY,
24
+ DEFAULT_HIGHLIGHT_LANGUAGES: () => DEFAULT_HIGHLIGHT_LANGUAGES,
24
25
  HASH_REGEXP: () => HASH_REGEXP,
25
26
  MDX_REGEXP: () => MDX_REGEXP,
26
27
  QUERY_REGEXP: () => QUERY_REGEXP,
@@ -1116,6 +1117,22 @@ var MDX_REGEXP = /\.mdx?$/;
1116
1117
  var APPEARANCE_KEY = "rspress-theme-appearance";
1117
1118
  var SEARCH_INDEX_NAME = "search_index";
1118
1119
  var RSPRESS_TEMP_DIR = ".rspress";
1120
+ var DEFAULT_HIGHLIGHT_LANGUAGES = [
1121
+ ["js", "javascript"],
1122
+ ["ts", "typescript"],
1123
+ ["jsx", "tsx"],
1124
+ "tsx",
1125
+ "json",
1126
+ "css",
1127
+ "scss",
1128
+ "less",
1129
+ ["xml", "xml-doc"],
1130
+ "diff",
1131
+ "yaml",
1132
+ ["md", "markdown"],
1133
+ ["mdx", "tsx"],
1134
+ "bash"
1135
+ ];
1119
1136
  var isSCM = () => Boolean(process.env.BUILD_VERSION);
1120
1137
  var isProduction = () => process.env.NODE_ENV === "production";
1121
1138
  var isDebugMode = () => Boolean(process.env.DOC_DEBUG);
@@ -1252,7 +1269,8 @@ function normalizeHref(url, cleanUrls = false) {
1252
1269
  if (url.startsWith("mailto:") || url.startsWith("tel:")) {
1253
1270
  return url;
1254
1271
  }
1255
- if (!cleanUrls && !cleanUrl2.endsWith(".html")) {
1272
+ const hasExt = cleanUrl2.split("/").pop()?.includes(".");
1273
+ if (!cleanUrls && !cleanUrl2.endsWith(".html") && !hasExt) {
1256
1274
  if (cleanUrl2.endsWith("/")) {
1257
1275
  cleanUrl2 += "index.html";
1258
1276
  } else {
@@ -1295,6 +1313,7 @@ var mergeDocConfig = (...configs) => mergeWith_default({}, ...configs, (target,
1295
1313
  // Annotate the CommonJS export names for ESM import in node:
1296
1314
  0 && (module.exports = {
1297
1315
  APPEARANCE_KEY,
1316
+ DEFAULT_HIGHLIGHT_LANGUAGES,
1298
1317
  HASH_REGEXP,
1299
1318
  MDX_REGEXP,
1300
1319
  QUERY_REGEXP,
package/dist/index.mjs CHANGED
@@ -1060,6 +1060,22 @@ var MDX_REGEXP = /\.mdx?$/;
1060
1060
  var APPEARANCE_KEY = "rspress-theme-appearance";
1061
1061
  var SEARCH_INDEX_NAME = "search_index";
1062
1062
  var RSPRESS_TEMP_DIR = ".rspress";
1063
+ var DEFAULT_HIGHLIGHT_LANGUAGES = [
1064
+ ["js", "javascript"],
1065
+ ["ts", "typescript"],
1066
+ ["jsx", "tsx"],
1067
+ "tsx",
1068
+ "json",
1069
+ "css",
1070
+ "scss",
1071
+ "less",
1072
+ ["xml", "xml-doc"],
1073
+ "diff",
1074
+ "yaml",
1075
+ ["md", "markdown"],
1076
+ ["mdx", "tsx"],
1077
+ "bash"
1078
+ ];
1063
1079
  var isSCM = () => Boolean(process.env.BUILD_VERSION);
1064
1080
  var isProduction = () => process.env.NODE_ENV === "production";
1065
1081
  var isDebugMode = () => Boolean(process.env.DOC_DEBUG);
@@ -1196,7 +1212,8 @@ function normalizeHref(url, cleanUrls = false) {
1196
1212
  if (url.startsWith("mailto:") || url.startsWith("tel:")) {
1197
1213
  return url;
1198
1214
  }
1199
- if (!cleanUrls && !cleanUrl2.endsWith(".html")) {
1215
+ const hasExt = cleanUrl2.split("/").pop()?.includes(".");
1216
+ if (!cleanUrls && !cleanUrl2.endsWith(".html") && !hasExt) {
1200
1217
  if (cleanUrl2.endsWith("/")) {
1201
1218
  cleanUrl2 += "index.html";
1202
1219
  } else {
@@ -1238,6 +1255,7 @@ var mergeDocConfig = (...configs) => mergeWith_default({}, ...configs, (target,
1238
1255
  });
1239
1256
  export {
1240
1257
  APPEARANCE_KEY,
1258
+ DEFAULT_HIGHLIGHT_LANGUAGES,
1241
1259
  HASH_REGEXP,
1242
1260
  MDX_REGEXP,
1243
1261
  QUERY_REGEXP,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "0.0.0-nightly-20231112160224",
3
+ "version": "0.0.0-nightly-20231114160228",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",