@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 +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/llms.txt +1 -1
- package/meta/api.json +2 -2
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
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
|
|
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
package/meta/api.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"category": "markdown",
|
|
3
|
-
"version": "2.0.0
|
|
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": "
|
|
9
|
+
"since": "2.0.0",
|
|
10
10
|
"signatures": [
|
|
11
11
|
{
|
|
12
12
|
"signature": "escape(str: string, options?: EscapeOptions): string",
|