@celhive/tool.js 0.0.5 → 0.0.6

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/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './formatCitation';
2
- export * from './getPDFViewerUrl';
3
- export * from './mendMarkdown';
4
- export * from './mockStream';
2
+ export * from './get-pdf-viewer-urll';
3
+ export * from './markdown-patch';
4
+ export * from './mock-stream';
5
5
  export * from './token-exceeded';
package/lib/index.js CHANGED
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./formatCitation"), exports);
18
- __exportStar(require("./getPDFViewerUrl"), exports);
19
- __exportStar(require("./mendMarkdown"), exports);
20
- __exportStar(require("./mockStream"), exports);
18
+ __exportStar(require("./get-pdf-viewer-urll"), exports);
19
+ __exportStar(require("./markdown-patch"), exports);
20
+ __exportStar(require("./mock-stream"), exports);
21
21
  __exportStar(require("./token-exceeded"), exports);
@@ -3,4 +3,4 @@
3
3
  * @param md - 需要修复的 markdown 字符串
4
4
  * @returns string 修复后的 markdown 字符串
5
5
  */
6
- export declare const mendMarkdown: (md: string) => string;
6
+ export declare const markdownPatch: (md: string) => string;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mendMarkdown = void 0;
3
+ exports.markdownPatch = void 0;
4
4
  /**
5
5
  * 修复 markdown 格式缺失问题
6
6
  * @param md - 需要修复的 markdown 字符串
7
7
  * @returns string 修复后的 markdown 字符串
8
8
  */
9
- const mendMarkdown = (md) => {
9
+ const markdownPatch = (md) => {
10
10
  const lines = md.split('\n');
11
11
  let inCodeBlock = false;
12
12
  const mendTitle = lines
@@ -40,7 +40,9 @@ const mendMarkdown = (md) => {
40
40
  : match;
41
41
  });
42
42
  // 写一个正则,如果 ```mermaid 前面只有一个换行符,就添加一个换行符
43
- const result = mendBold.replace(/(\n)```mermaid/g, '$1\n```mermaid');
43
+ const mendMermaid = mendBold.replace(/(\n)```mermaid/g, '$1\n```mermaid');
44
+ // 在连续的 # 符号(1个以上)前面插入换行符,但不处理行首的 #
45
+ const result = mendMermaid.replace(/([^\n#])(#{2,})/g, '$1\n$2');
44
46
  return result;
45
47
  };
46
- exports.mendMarkdown = mendMarkdown;
48
+ exports.markdownPatch = markdownPatch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celhive/tool.js",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -12,7 +12,8 @@
12
12
  "test": "vitest --coverage run",
13
13
  "doc": "typedoc",
14
14
  "watch-doc": "onchange 'src/**/*.ts' './README.md' -- npm run doc",
15
- "watch-preview": "live-server doc"
15
+ "watch-preview": "live-server doc",
16
+ "deploy-doc": "pnpm build && rsync -avz --delete doc/ twitter:/usr/share/nginx/tool.js --rsync-path='sudo rsync'"
16
17
  },
17
18
  "dependencies": {
18
19
  "concurrently": "^8.2.0",
File without changes
File without changes