@alauda/doom 0.11.6 → 0.11.7

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.
@@ -3,6 +3,7 @@ import path from 'node:path';
3
3
  import { logger } from '@rspress/shared/logger';
4
4
  import { loadFrontMatter } from '@rspress/shared/node-utils';
5
5
  import { pathExists } from '../../utils/index.js';
6
+ import { extractTextAndId } from '../replace/utils.js';
6
7
  export async function detectFilePath(rawPath, extensions) {
7
8
  // The params doesn't have extension name, so we need to try to find the file with the extension name.
8
9
  let realPath = rawPath;
@@ -42,7 +43,7 @@ export async function extractInfoFromFrontmatter(filePath, rootDir, extensions)
42
43
  const { frontmatter } = loadFrontMatter(content, filePath, rootDir);
43
44
  return {
44
45
  realPath,
45
- title: frontmatter.title || contentTitle || fileNameWithoutExt,
46
+ title: extractTextAndId(frontmatter.title || contentTitle || fileNameWithoutExt)[0],
46
47
  overviewHeaders: frontmatter.overviewHeaders,
47
48
  context: frontmatter.context,
48
49
  weight: frontmatter.weight,
@@ -10,7 +10,7 @@ import { red } from 'yoctocolors';
10
10
  * hello world {#custom-id} -> { text: 'hello world', id: 'custom-id' }
11
11
  */
12
12
  export const extractTextAndId = (title) => {
13
- const customIdReg = /{#.*}/;
13
+ const customIdReg = /\\?{#.*}/;
14
14
  const text = title.replace(customIdReg, '').trimEnd();
15
15
  const customId = title.match(customIdReg)?.[0]?.slice(2, -1) || '';
16
16
  return [text, customId];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "0.11.6",
3
+ "version": "0.11.7",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": {