markdansi 0.1.0 → 0.1.2
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/README.md +13 -10
- package/dist/cli.d.ts +16 -0
- package/dist/cli.js +166 -0
- package/dist/hyperlink.d.ts +9 -0
- package/dist/hyperlink.js +26 -0
- package/dist/index.d.ts +8 -45
- package/dist/index.js +15 -0
- package/dist/parser.d.ts +2 -0
- package/{src → dist}/parser.js +4 -5
- package/dist/render.d.ts +9 -0
- package/dist/render.js +548 -0
- package/dist/theme.d.ts +18 -0
- package/dist/theme.js +105 -0
- package/dist/types.d.ts +58 -0
- package/dist/types.js +1 -0
- package/dist/wrap.d.ts +10 -0
- package/dist/wrap.js +48 -0
- package/docs/spec.md +24 -10
- package/package.json +12 -10
- package/tsconfig.json +2 -4
- package/src/cli.js +0 -62
- package/src/hyperlink.js +0 -15
- package/src/index.js +0 -12
- package/src/render.js +0 -342
- package/src/theme.js +0 -53
- package/src/wrap.js +0 -45
- package/types/index.ts +0 -74
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type ColorName = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | `#${string}` | `${number}`;
|
|
2
|
+
export type StyleIntent = {
|
|
3
|
+
color?: ColorName;
|
|
4
|
+
bgColor?: ColorName;
|
|
5
|
+
bold?: boolean;
|
|
6
|
+
italic?: boolean;
|
|
7
|
+
underline?: boolean;
|
|
8
|
+
dim?: boolean;
|
|
9
|
+
strike?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type Theme = {
|
|
12
|
+
heading?: StyleIntent;
|
|
13
|
+
strong?: StyleIntent;
|
|
14
|
+
emph?: StyleIntent;
|
|
15
|
+
inlineCode?: StyleIntent;
|
|
16
|
+
blockCode?: StyleIntent;
|
|
17
|
+
code?: StyleIntent;
|
|
18
|
+
link?: StyleIntent;
|
|
19
|
+
quote?: StyleIntent;
|
|
20
|
+
hr?: StyleIntent;
|
|
21
|
+
listMarker?: StyleIntent;
|
|
22
|
+
tableHeader?: StyleIntent;
|
|
23
|
+
tableCell?: StyleIntent;
|
|
24
|
+
};
|
|
25
|
+
export type ThemeName = "default" | "dim" | "bright";
|
|
26
|
+
export type Highlighter = (code: string, lang?: string) => string;
|
|
27
|
+
export interface RenderOptions {
|
|
28
|
+
wrap?: boolean;
|
|
29
|
+
width?: number;
|
|
30
|
+
hyperlinks?: boolean;
|
|
31
|
+
color?: boolean;
|
|
32
|
+
theme?: ThemeName | Theme;
|
|
33
|
+
/**
|
|
34
|
+
* Spaces per nesting level for lists (default 2).
|
|
35
|
+
*/
|
|
36
|
+
listIndent?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Prefix used for blockquotes (default "│ ").
|
|
39
|
+
*/
|
|
40
|
+
quotePrefix?: string;
|
|
41
|
+
/** Table border style: unicode (default), ascii, or none. */
|
|
42
|
+
tableBorder?: "unicode" | "ascii" | "none";
|
|
43
|
+
/** Spaces around cell content (default 1). */
|
|
44
|
+
tablePadding?: number;
|
|
45
|
+
/** If true, reduces separator rows (default false). */
|
|
46
|
+
tableDense?: boolean;
|
|
47
|
+
/** If true, truncates cell content to fit column width (default true). */
|
|
48
|
+
tableTruncate?: boolean;
|
|
49
|
+
/** Ellipsis text for truncation (default "…"). */
|
|
50
|
+
tableEllipsis?: string;
|
|
51
|
+
/** Draw a box around fenced code blocks (default true). */
|
|
52
|
+
codeBox?: boolean;
|
|
53
|
+
/** Show line-number gutter for code blocks (default false). */
|
|
54
|
+
codeGutter?: boolean;
|
|
55
|
+
/** Wrap code lines to width; otherwise overflow (default true). */
|
|
56
|
+
codeWrap?: boolean;
|
|
57
|
+
highlighter?: Highlighter;
|
|
58
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/wrap.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visible width of a string, ignoring ANSI escape codes.
|
|
3
|
+
*/
|
|
4
|
+
export declare function visibleWidth(text: string): number;
|
|
5
|
+
/**
|
|
6
|
+
* Wrap a single paragraph string into lines respecting visible width.
|
|
7
|
+
* Breaks only on spaces. Words longer than width overflow.
|
|
8
|
+
*/
|
|
9
|
+
export declare function wrapText(text: string, width: number, wrap: boolean): string[];
|
|
10
|
+
export declare function wrapWithPrefix(text: string, width: number, wrap: boolean, prefix?: string): string[];
|
package/dist/wrap.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import stringWidth from "string-width";
|
|
2
|
+
import stripAnsi from "strip-ansi";
|
|
3
|
+
/**
|
|
4
|
+
* Visible width of a string, ignoring ANSI escape codes.
|
|
5
|
+
*/
|
|
6
|
+
export function visibleWidth(text) {
|
|
7
|
+
return stringWidth(stripAnsi(text));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Wrap a single paragraph string into lines respecting visible width.
|
|
11
|
+
* Breaks only on spaces. Words longer than width overflow.
|
|
12
|
+
*/
|
|
13
|
+
export function wrapText(text, width, wrap) {
|
|
14
|
+
if (!wrap || width <= 0)
|
|
15
|
+
return [text];
|
|
16
|
+
const words = text.split(/(\s+)/).filter((w) => w.length > 0);
|
|
17
|
+
const lines = [];
|
|
18
|
+
let current = "";
|
|
19
|
+
let currentWidth = 0;
|
|
20
|
+
for (const word of words) {
|
|
21
|
+
const w = visibleWidth(word);
|
|
22
|
+
if (current !== "" && currentWidth + w > width && !/^\s+$/.test(word)) {
|
|
23
|
+
lines.push(current);
|
|
24
|
+
current = word.replace(/^\s+/, "");
|
|
25
|
+
currentWidth = visibleWidth(current);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
current += word;
|
|
29
|
+
currentWidth = visibleWidth(current);
|
|
30
|
+
}
|
|
31
|
+
if (current !== "")
|
|
32
|
+
lines.push(current);
|
|
33
|
+
if (lines.length === 0)
|
|
34
|
+
lines.push("");
|
|
35
|
+
return lines;
|
|
36
|
+
}
|
|
37
|
+
export function wrapWithPrefix(text, width, wrap, prefix = "") {
|
|
38
|
+
if (!wrap)
|
|
39
|
+
return text.split("\n").map((line) => prefix + line);
|
|
40
|
+
const out = [];
|
|
41
|
+
const w = Math.max(1, width - visibleWidth(prefix));
|
|
42
|
+
for (const line of text.split("\n")) {
|
|
43
|
+
const parts = wrapText(line, w, wrap);
|
|
44
|
+
for (const p of parts)
|
|
45
|
+
out.push(prefix + p);
|
|
46
|
+
}
|
|
47
|
+
return out;
|
|
48
|
+
}
|
package/docs/spec.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Markdansi
|
|
1
|
+
# Markdansi v0.1.2 – Design Spec
|
|
2
2
|
|
|
3
3
|
Goal: Tiny, dependency‑light Markdown → ANSI renderer & CLI for Node ≥22, using pnpm. Output is terminal ANSI only (no HTML). Focus on readable defaults, sensible wrapping, and minimal runtime deps.
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ Goal: Tiny, dependency‑light Markdown → ANSI renderer & CLI for Node ≥22,
|
|
|
9
9
|
- `strip-ansi`: strip codes for width/wrapping.
|
|
10
10
|
- `supports-hyperlinks`: detect OSC‑8 hyperlink support.
|
|
11
11
|
|
|
12
|
-
Dev: `vitest
|
|
12
|
+
Dev: `vitest`, TypeScript (NodeNext).
|
|
13
13
|
|
|
14
14
|
## Surface Area
|
|
15
15
|
### Library (ESM default, CJS export provided)
|
|
@@ -22,12 +22,22 @@ Dev: `vitest`.
|
|
|
22
22
|
` width?: number; // used only when wrap===true; default: TTY cols or 80`
|
|
23
23
|
` hyperlinks?: boolean; // default: auto via supports-hyperlinks`
|
|
24
24
|
` color?: boolean; // default: true if TTY; if false => no ANSI/OSC at all`
|
|
25
|
-
` theme?: ThemeName | Theme; // built-ins: default, dim, bright`
|
|
25
|
+
` theme?: ThemeName | Theme; // built-ins: default, dim, bright, solarized, monochrome, contrast`
|
|
26
|
+
` listIndent?: number; // spaces per nesting level; default 2`
|
|
27
|
+
` quotePrefix?: string; // blockquote line prefix; default "│ "`
|
|
28
|
+
` tableBorder?: "unicode" | "ascii" | "none"; // default unicode box drawing`
|
|
29
|
+
` tablePadding?: number; // spaces inside cells (L/R); default 1`
|
|
30
|
+
` tableDense?: boolean; // reduce separator rows; default false`
|
|
31
|
+
` tableTruncate?: boolean; // truncate cells to fit col widths; default true`
|
|
32
|
+
` tableEllipsis?: string; // truncation marker; default "…"`
|
|
33
|
+
` codeBox?: boolean; // draw a box around fenced code; default true`
|
|
34
|
+
` codeGutter?: boolean; // left gutter with line numbers; default false`
|
|
35
|
+
` codeWrap?: boolean; // wrap code to width; default true`
|
|
26
36
|
` highlighter?: (code: string, lang?: string) => string; // hook, must not add newlines`
|
|
27
37
|
`}``
|
|
28
38
|
|
|
29
|
-
`type Theme = { heading, strong, emph, inlineCode, blockCode, code?, link, quote, hr, listMarker, tableHeader, tableCell }`
|
|
30
|
-
Each theme entry holds simple SGR intents (bold/italic/fg color names). `inlineCode` / `blockCode` are used if present; otherwise `code` acts as a fallback for both.
|
|
39
|
+
`type Theme = { heading, strong, emph, inlineCode, blockCode, code?, link, quote, hr, listMarker, tableHeader, tableCell, tableBorder, tableSeparator }`
|
|
40
|
+
Each theme entry holds simple SGR intents (bold/italic/fg color names). `inlineCode` / `blockCode` are used if present; otherwise `code` acts as a fallback for both. Theme exposes defaults for table borders/separators; caller can override per render via options above.
|
|
31
41
|
|
|
32
42
|
`strip(markdown: string): string` — convenience: render with `color=false`, `hyperlinks=false`.
|
|
33
43
|
|
|
@@ -41,9 +51,9 @@ Each theme entry holds simple SGR intents (bold/italic/fg color names). `inlineC
|
|
|
41
51
|
## Feature Scope (v1)
|
|
42
52
|
- Blocks: paragraphs, headings (1–6), blockquotes, fenced/indented code blocks, HR, tables, unordered/ordered lists, task lists.
|
|
43
53
|
- Inline: strong, emphasis, code spans, autolinks/links, strikethrough (GFM `~~`), backslash escapes.
|
|
44
|
-
- Code blocks: monospace
|
|
45
|
-
- Tables:
|
|
46
|
-
- Wrapping: word-wrap on spaces; uses `string-width` on stripped text. Preserve hard breaks; words longer than width
|
|
54
|
+
- Code blocks: monospace box (unicode or ascii; `codeBox=false` disables). Optional gutter with 1‑based line numbers when `codeGutter=true`. If `lang` present, show faint header label. Highlighter hook may recolor text but must not add/remove newlines. Code blocks wrap to the available width by default (hard-wrap long tokens); set `codeWrap=false` to allow overflow.
|
|
55
|
+
- Tables: box-drawing (unicode default, ascii or none). Respect GFM alignment per column, pad cells by `tablePadding`, optional dense borders. Can truncate cell text (`tableTruncate=true`, `tableEllipsis` marker) to keep width. Width balancing shrinks columns while possible; if still too wide, cells overflow.
|
|
56
|
+
- Wrapping: word-wrap on spaces; uses `string-width` on stripped text. Preserve hard breaks; words longer than width may overflow. Code blocks wrap by default; turn off with `codeWrap=false`.
|
|
47
57
|
- Hyperlinks: OSC‑8 when supported and allowed; fallback to underlined text plus URL in parentheses.
|
|
48
58
|
- Error handling: never throw on malformed emphasis; leave literals untouched if unmatched.
|
|
49
59
|
|
|
@@ -57,9 +67,12 @@ Each theme entry holds simple SGR intents (bold/italic/fg color names). `inlineC
|
|
|
57
67
|
- Track active SGR for wrapping splits to re-open styles on new lines.
|
|
58
68
|
|
|
59
69
|
## Themes (initial)
|
|
60
|
-
- `default`: bold headings, blue links, cyan code, subtle quotes/hr.
|
|
70
|
+
- `default`: bold headings, blue links, cyan inline code, green block code, yellow table headers, subtle quotes/hr.
|
|
61
71
|
- `dim`: muted colors for low-contrast terminals.
|
|
62
72
|
- `bright`: higher contrast variant.
|
|
73
|
+
- `solarized`: yellow headings, cyan inline, teal block code, blue links, yellow headers.
|
|
74
|
+
- `monochrome`: bold/italic cues only, dim code, underlined links.
|
|
75
|
+
- `contrast`: magenta headings, cyan inline, green block code, yellow headers, bright markers.
|
|
63
76
|
|
|
64
77
|
## Testing (vitest)
|
|
65
78
|
- Unit: inline formatting (emph/strong/code/strike), links/hyperlinks on/off, wrap/no-wrap behavior, table alignment and wrapping, task lists, strikethrough.
|
|
@@ -77,7 +90,8 @@ Each theme entry holds simple SGR intents (bold/italic/fg color names). `inlineC
|
|
|
77
90
|
- Color flag: `color=false` removes all ANSI/OSC output (no bold/italic/underline, no hyperlinks); output is plain text.
|
|
78
91
|
- Hyperlinks fallback: inline links render as `label (url)` when OSC‑8 disabled; autolinks render as the URL only. URLs count toward width.
|
|
79
92
|
- Highlighter hook: receives raw code and optional lang; may return ANSI-colored text but must not add or remove newlines. Markdansi owns indentation/padding; code blocks never hard-wrap.
|
|
80
|
-
- Tables width algorithm: compute desired column widths from content (cap at e.g. 40). While total exceeds width, decrement widest columns until it fits; if even minimums won’t fit, allow overflow. Respect GFM alignment per column. Cells with newlines keep those breaks.
|
|
93
|
+
- Tables width algorithm: compute desired column widths from content (cap at e.g. 40). While total exceeds width, decrement widest columns until it fits; if even minimums won’t fit, allow overflow. Respect GFM alignment per column. Cells with newlines keep those breaks. Optional truncation shortens cells before layout with `tableEllipsis`.
|
|
81
94
|
- Lists: honor GFM tight vs loose lists (tight => no blank line between items; loose => blank line). Nesting indent = 2 spaces per level; bullets use `-`; ordered lists use input numbering.
|
|
82
95
|
- Blockquotes: prefix each wrapped line with `│ ` (configurable via `quotePrefix`); quote content wraps accounting for the prefix width.
|
|
83
96
|
- List indent is configurable via `listIndent` (default 2 spaces per level).
|
|
97
|
+
- Reference-style definitions with indented title continuations are merged into a single paragraph (instead of becoming indented code blocks), preventing stray boxed output in copied logs.
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdansi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Tiny dependency-light markdown to ANSI converter.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "dist/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"import": "./
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
10
|
},
|
|
11
|
-
"./cli": "./
|
|
11
|
+
"./cli": "./dist/cli.js"
|
|
12
12
|
},
|
|
13
13
|
"bin": {
|
|
14
|
-
"markdansi": "./
|
|
14
|
+
"markdansi": "./dist/cli.js"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
17
|
"markdown",
|
|
@@ -34,14 +34,12 @@
|
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"files": [
|
|
37
|
-
"src",
|
|
38
37
|
"dist",
|
|
39
38
|
"README.md",
|
|
40
39
|
"docs/spec.md",
|
|
41
40
|
"package.json",
|
|
42
41
|
"tsconfig.json",
|
|
43
|
-
".biome.json"
|
|
44
|
-
"types"
|
|
42
|
+
".biome.json"
|
|
45
43
|
],
|
|
46
44
|
"types": "dist/index.d.ts",
|
|
47
45
|
"dependencies": {
|
|
@@ -57,17 +55,21 @@
|
|
|
57
55
|
},
|
|
58
56
|
"devDependencies": {
|
|
59
57
|
"@biomejs/biome": "^2.3.5",
|
|
58
|
+
"@types/mdast": "^4.0.4",
|
|
60
59
|
"@types/node": "^24.10.1",
|
|
61
60
|
"@vitest/coverage-v8": "^4.0.9",
|
|
61
|
+
"tsx": "^4.20.6",
|
|
62
62
|
"typescript": "^5.9.3",
|
|
63
63
|
"vitest": "^4.0.9"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
|
-
"build": "pnpm lint && pnpm test",
|
|
66
|
+
"build": "pnpm lint && pnpm test && pnpm compile",
|
|
67
67
|
"clean": "rm -rf dist",
|
|
68
68
|
"lint": "rm -rf dist coverage && biome check .",
|
|
69
69
|
"test": "vitest run",
|
|
70
70
|
"test:coverage": "vitest run --coverage",
|
|
71
|
-
"types": "tsc -p tsconfig.json"
|
|
71
|
+
"types": "tsc -p tsconfig.json --emitDeclarationOnly",
|
|
72
|
+
"compile": "tsc -p tsconfig.json",
|
|
73
|
+
"markdansi": "tsx src/cli.ts"
|
|
72
74
|
}
|
|
73
75
|
}
|
package/tsconfig.json
CHANGED
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
"noUncheckedIndexedAccess": true,
|
|
5
5
|
"exactOptionalPropertyTypes": true,
|
|
6
6
|
"noPropertyAccessFromIndexSignature": true,
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
"checkJs": true,
|
|
9
7
|
"declaration": true,
|
|
10
|
-
"emitDeclarationOnly": true,
|
|
11
8
|
"outDir": "dist",
|
|
9
|
+
"rootDir": "src",
|
|
12
10
|
"module": "NodeNext",
|
|
13
11
|
"moduleResolution": "NodeNext",
|
|
14
12
|
"target": "ES2022",
|
|
15
13
|
"resolveJsonModule": true
|
|
16
14
|
},
|
|
17
|
-
"include": ["
|
|
15
|
+
"include": ["src/**/*.ts"],
|
|
18
16
|
"exclude": ["node_modules", "dist", "coverage"]
|
|
19
17
|
}
|
package/src/cli.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { render } from "./index.js";
|
|
5
|
-
|
|
6
|
-
function parseArgs(argv) {
|
|
7
|
-
const args = {};
|
|
8
|
-
for (let i = 2; i < argv.length; i += 1) {
|
|
9
|
-
const a = argv[i];
|
|
10
|
-
if (a === "--no-wrap") args.wrap = false;
|
|
11
|
-
else if (a === "--no-color") args.color = false;
|
|
12
|
-
else if (a === "--no-links") args.hyperlinks = false;
|
|
13
|
-
else if (a === "--in") args.in = argv[++i];
|
|
14
|
-
else if (a === "--out") args.out = argv[++i];
|
|
15
|
-
else if (a === "--width") args.width = Number(argv[++i]);
|
|
16
|
-
else if (a.startsWith("--theme=")) args.theme = a.split("=")[1];
|
|
17
|
-
else if (a === "--list-indent") args.listIndent = Number(argv[++i]);
|
|
18
|
-
else if (a === "--quote-prefix") args.quotePrefix = argv[++i];
|
|
19
|
-
else if (a === "--help" || a === "-h") args.help = true;
|
|
20
|
-
}
|
|
21
|
-
return args;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function main() {
|
|
25
|
-
const args = parseArgs(process.argv);
|
|
26
|
-
if (args.help) {
|
|
27
|
-
process.stdout.write(`markdansi options:
|
|
28
|
-
--in FILE Input file (default: stdin)
|
|
29
|
-
--out FILE Output file (default: stdout)
|
|
30
|
-
--width N Wrap width (default: TTY cols or 80)
|
|
31
|
-
--no-wrap Disable hard wrapping
|
|
32
|
-
--no-color Disable ANSI/OSC output
|
|
33
|
-
--no-links Disable OSC-8 hyperlinks
|
|
34
|
-
--theme NAME Theme (default|dim|bright)
|
|
35
|
-
--list-indent N Spaces per list nesting level (default: 2)
|
|
36
|
-
--quote-prefix STR Prefix for blockquotes (default: "│ ")
|
|
37
|
-
`);
|
|
38
|
-
process.exit(0);
|
|
39
|
-
}
|
|
40
|
-
const input =
|
|
41
|
-
args.in && args.in !== "-"
|
|
42
|
-
? fs.readFileSync(path.resolve(args.in), "utf8")
|
|
43
|
-
: fs.readFileSync(0, "utf8");
|
|
44
|
-
|
|
45
|
-
const output = render(input, {
|
|
46
|
-
wrap: args.wrap,
|
|
47
|
-
width: args.width,
|
|
48
|
-
color: args.color,
|
|
49
|
-
hyperlinks: args.hyperlinks,
|
|
50
|
-
theme: args.theme,
|
|
51
|
-
listIndent: args.listIndent,
|
|
52
|
-
quotePrefix: args.quotePrefix,
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
if (args.out) {
|
|
56
|
-
fs.writeFileSync(path.resolve(args.out), output, "utf8");
|
|
57
|
-
} else {
|
|
58
|
-
process.stdout.write(output);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
main();
|
package/src/hyperlink.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import supportsHyperlinks from "supports-hyperlinks";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Detect OSC-8 hyperlink support for a given stream (defaults to stdout).
|
|
5
|
-
*/
|
|
6
|
-
export function hyperlinkSupported(stream = process.stdout) {
|
|
7
|
-
if (supportsHyperlinks && typeof supportsHyperlinks.stdout === "function") {
|
|
8
|
-
return supportsHyperlinks.stdout(stream);
|
|
9
|
-
}
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function osc8(url, text) {
|
|
14
|
-
return `\u001B]8;;${url}\u0007${text}\u001B]8;;\u0007`;
|
|
15
|
-
}
|
package/src/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createRenderer, render as renderMarkdown } from "./render.js";
|
|
2
|
-
import { themes } from "./theme.js";
|
|
3
|
-
|
|
4
|
-
export { renderMarkdown as render, createRenderer, themes };
|
|
5
|
-
|
|
6
|
-
export function strip(markdown, options = {}) {
|
|
7
|
-
return renderMarkdown(markdown, {
|
|
8
|
-
...options,
|
|
9
|
-
color: false,
|
|
10
|
-
hyperlinks: false,
|
|
11
|
-
});
|
|
12
|
-
}
|