@helpers4/markdown 2.0.0-beta.3 → 2.0.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.
package/lib/index.d.ts CHANGED
@@ -37,7 +37,7 @@ interface EscapeOptions {
37
37
  *
38
38
  * escape('foo | bar', { cell: true })
39
39
  * // => 'foo \\| bar'
40
- * @since next
40
+ * @since 2.0.0
41
41
  */
42
42
  declare function escape(str: string, options?: EscapeOptions): string;
43
43
 
package/lib/index.js CHANGED
@@ -20,7 +20,7 @@
20
20
  *
21
21
  * escape('foo | bar', { cell: true })
22
22
  * // => 'foo \\| bar'
23
- * @since next
23
+ * @since 2.0.0
24
24
  */
25
25
  function escape(str, options) {
26
26
  let result = str.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../helpers/markdown/escape.ts"],"sourcesContent":["/**\n * This file is part of helpers4.\n * Copyright (C) 2025 baxyz\n * SPDX-License-Identifier: LGPL-3.0-or-later\n */\n\n/**\n * Options for {@link escape}.\n */\nexport interface EscapeOptions {\n /**\n * When `true`, additionally escapes pipe characters (`|`) and replaces\n * newlines with spaces, making the result safe for use as a Markdown table\n * cell value.\n *\n * @default false\n */\n cell?: boolean;\n}\n\n/**\n * Escapes all Markdown special characters in a string so they render as\n * literal text rather than formatting syntax.\n *\n * Escaped characters: `\\ \\` * _ { } [ ] ( ) # + - . !`\n *\n * Pass `{ cell: true }` to also escape pipe characters and replace newlines\n * with spaces, making the result safe for embedding in a Markdown table cell.\n *\n * @param str - The raw string to escape\n * @param options - Optional escaping options\n * @returns The escaped string\n * @example\n * escape('**bold** and _italic_')\n * // => '\\\\*\\\\*bold\\\\*\\\\* and \\\\_italic\\\\_'\n *\n * escape('[link](url)')\n * // => '\\\\[link\\\\]\\\\(url\\\\)'\n *\n * escape('foo | bar', { cell: true })\n * // => 'foo \\\\| bar'\n * @since next\n */\nexport function escape(str: string, options?: EscapeOptions): string {\n let result = str.replace(/[\\\\`*_{}[\\]()#+\\-.!]/g, '\\\\$&');\n if (options?.cell) {\n result = result.replace(/\\|/g, '\\\\|').replace(/\\n/g, ' ');\n }\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAgB,OAAO,KAAa,SAAiC;CACnE,IAAI,SAAS,IAAI,QAAQ,yBAAyB,OAAO;CACzD,IAAI,SAAS,MACX,SAAS,OAAO,QAAQ,OAAO,MAAM,CAAC,QAAQ,OAAO,IAAI;CAE3D,OAAO"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../helpers/markdown/escape.ts"],"sourcesContent":["/**\n * This file is part of helpers4.\n * Copyright (C) 2025 baxyz\n * SPDX-License-Identifier: LGPL-3.0-or-later\n */\n\n/**\n * Options for {@link escape}.\n */\nexport interface EscapeOptions {\n /**\n * When `true`, additionally escapes pipe characters (`|`) and replaces\n * newlines with spaces, making the result safe for use as a Markdown table\n * cell value.\n *\n * @default false\n */\n cell?: boolean;\n}\n\n/**\n * Escapes all Markdown special characters in a string so they render as\n * literal text rather than formatting syntax.\n *\n * Escaped characters: `\\ \\` * _ { } [ ] ( ) # + - . !`\n *\n * Pass `{ cell: true }` to also escape pipe characters and replace newlines\n * with spaces, making the result safe for embedding in a Markdown table cell.\n *\n * @param str - The raw string to escape\n * @param options - Optional escaping options\n * @returns The escaped string\n * @example\n * escape('**bold** and _italic_')\n * // => '\\\\*\\\\*bold\\\\*\\\\* and \\\\_italic\\\\_'\n *\n * escape('[link](url)')\n * // => '\\\\[link\\\\]\\\\(url\\\\)'\n *\n * escape('foo | bar', { cell: true })\n * // => 'foo \\\\| bar'\n * @since 2.0.0\n */\nexport function escape(str: string, options?: EscapeOptions): string {\n let result = str.replace(/[\\\\`*_{}[\\]()#+\\-.!]/g, '\\\\$&');\n if (options?.cell) {\n result = result.replace(/\\|/g, '\\\\|').replace(/\\n/g, ' ');\n }\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAgB,OAAO,KAAa,SAAiC;CACnE,IAAI,SAAS,IAAI,QAAQ,yBAAyB,MAAM;CACxD,IAAI,SAAS,MACX,SAAS,OAAO,QAAQ,OAAO,KAAK,EAAE,QAAQ,OAAO,GAAG;CAE1D,OAAO;AACT"}
package/llms.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  # @helpers4/markdown
2
2
 
3
3
  > Tree-shakable TypeScript utility functions for the `markdown` domain.
4
- > Package: `@helpers4/markdown` — Version: 2.0.0-beta.3
4
+ > Package: `@helpers4/markdown` — Version: 2.0.0
5
5
  > License: LGPL-3.0-or-later
6
6
 
7
7
  ## Installation
package/meta/api.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "category": "markdown",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0",
4
4
  "functions": [
5
5
  {
6
6
  "name": "escape",
7
7
  "kind": "function",
8
8
  "description": "Escapes all Markdown special characters in a string so they render as\nliteral text rather than formatting syntax.\n\nEscaped characters: `\\ \\` * _ { } [ ] ( ) # + - . !`\n\nPass `{ cell: true }` to also escape pipe characters and replace newlines\nwith spaces, making the result safe for embedding in a Markdown table cell.",
9
- "since": "next",
9
+ "since": "2.0.0",
10
10
  "signatures": [
11
11
  {
12
12
  "signature": "escape(str: string, options?: EscapeOptions): string",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpers4/markdown",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0",
4
4
  "description": "A set of helpers in TS/JS, compatible with tree-shaking, for markdown.",
5
5
  "author": "baxyz <baxy@etik.com>",
6
6
  "license": "LGPL-3.0",