@dogsbay/adoc2md-modular 0.2.0-beta.101
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/LINEAGE.md +68 -0
- package/README.md +69 -0
- package/bin/adoc2md.js +157 -0
- package/bin/url.js +29 -0
- package/dist/engine.d.ts +17 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +6034 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +209 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/LINEAGE.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# LINEAGE
|
|
2
|
+
|
|
3
|
+
`packages/adoc2md-modular/src/engine.js` is a fork of [downdoc](https://gitlab.com/antora/downdoc) by Dan Allen (Apache-2.0), substantially modified by the `~/dev/md2md` prototype, then carried into Dogsbay verbatim during Phase 4 of [`plans/format-asciidoc-import.md`](../../plans/format-asciidoc-import.md).
|
|
4
|
+
|
|
5
|
+
**Date copied into Dogsbay:** 2026-05-13.
|
|
6
|
+
**Source file:** `~/dev/md2md/src/downdoc.js` (the md2md prototype's modified fork — not the upstream downdoc).
|
|
7
|
+
**Upstream fork commit:** `e2ea8d9` (2026-02-13) — the last md2md commit to touch `downdoc.js`.
|
|
8
|
+
**Size:** 2069 lines.
|
|
9
|
+
**License:** Apache-2.0 (inherited from downdoc upstream).
|
|
10
|
+
|
|
11
|
+
## Why we forked
|
|
12
|
+
|
|
13
|
+
Upstream downdoc handles single-file AsciiDoc → Markdown conversion well. The md2md prototype's fork extends it for **modular-content** workflows — the patterns Red Hat (AAP, OpenShift) and Antora-style doc sites use heavily:
|
|
14
|
+
|
|
15
|
+
- `include::` directives in a multi-file corpus (with `leveloffset` adjustment)
|
|
16
|
+
- `ifdef::`/`ifndef::` conditionals where the attribute context is supplied at convert time (or preserved for later resolution)
|
|
17
|
+
- Document-level `:attr: value` declarations interleaved with prose
|
|
18
|
+
- Attribute references `{name}` resolved against a layered attribute context
|
|
19
|
+
|
|
20
|
+
The fork's strategy is to **emit Minja directives** for the constructs that depend on a runtime context — `{{ name }}` for attribute refs, `{% if name %}…{% endif %}` for conditionals, `{% include "./<path>.md" %}` for includes, `{% set name = "value" %}` for in-doc attribute entries. Downstream [`@dogsbay/minja`](../minja/) then evaluates those directives with the actual context. This two-stage pipeline keeps the AsciiDoc-syntax converter free of I/O and runtime-state concerns.
|
|
21
|
+
|
|
22
|
+
## Changes from upstream downdoc
|
|
23
|
+
|
|
24
|
+
The engine's design docs were migrated from md2md into [`docs-dev/`](./docs-dev/) on 2026-05-21 — `DESIGN-DECISIONS.md` (the DD-### log; **DD-009** governs Pandoc dlist placement, **DD-010** the admonition formats), `GOTCHAS.md`, and `ARCHITECTURE.md`. They enumerate the modifications below; their inline code line numbers are from the upstream fork point and may have drifted. Key surface-level deltas the test suite locked in:
|
|
25
|
+
|
|
26
|
+
| Change | Where (rough) | Why |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| Attribute refs `{name}` always emit `{{ name }}` Minja vars (never inline-substitute) | `applySubs` / `attributes()` path | Two-stage pipeline — Minja resolves at render time. |
|
|
29
|
+
| `:name: value` entries emit `{%- set name = "value" %}` | Top-level attribute-entry handler | Preserves attribute scope through includes. |
|
|
30
|
+
| `ifdef::name[]` / `ifndef::name[]` / `endif::[]` emit `{% if … %}…{% endif %}` (never evaluated inline) | Preprocessor-directive path | Minja evaluates with runtime context. |
|
|
31
|
+
| `include::path.adoc[]` emits `{% include "./path.md" %}` (extension auto-converted) when `nunjucksIncludes=true` | `resolveIncludes` | Pipeline emits Markdown; included sibling will also be Markdown. |
|
|
32
|
+
| Smart indentation for includes (top-level list items get special handling) | `resolveIncludes` | Avoids breaking list semantics across include boundaries. |
|
|
33
|
+
| Custom ID format `{id="..."}` on sub-headings | Heading emitter | Markdown-it-compatible; supports stable anchors. |
|
|
34
|
+
| 4-space list indentation | Constant `markdown-list-indent=4` | Mirrors mkdocs-material's canonical form. |
|
|
35
|
+
| Permissive empty-line handling | Various block parsers | Real-world AAP / OpenShift docs are quirky. |
|
|
36
|
+
| UI macros (`btn`, `kbd`, `menu`) converted to HTML | Inline macro path | Cross-renderer compatibility. |
|
|
37
|
+
| `:!aws:` AsciiDoc unset → `{% set aws = false %}` | Attribute-entry handler | Minja-friendly representation of unset. |
|
|
38
|
+
| List numbering uses uniform `1.` (not incremented) | List emitter | Cleaner version-control diffs. |
|
|
39
|
+
| Admonitions: line-form (`NOTE: …`) always HTML-ish (`**📌 NOTE**\`); only block-form (`[NOTE]\n====\n…\n====`) respects `admonitionFormat` | Admonition emitter | Line-form is a single-line construct; block-form is the configurable surface. |
|
|
40
|
+
|
|
41
|
+
## What we changed during the Dogsbay port
|
|
42
|
+
|
|
43
|
+
Minimal — kept the engine as plain JS to minimise regression risk:
|
|
44
|
+
|
|
45
|
+
1. **CommonJS → ESM**: 4 lines at the top of the file.
|
|
46
|
+
- `'use strict'` → removed (ESM is strict)
|
|
47
|
+
- `const fs = require('fs')` → `import fs from 'node:fs'`
|
|
48
|
+
- `const path = require('path')` → `import path from 'node:path'`
|
|
49
|
+
- `module.exports = function downdoc (…)` → `export default function downdoc (…)`
|
|
50
|
+
2. **`engine.d.ts`** hand-written for the public surface (`EngineOptions` + default export).
|
|
51
|
+
3. **No other code edits.** The 2069 lines of converter logic are byte-identical to the md2md prototype.
|
|
52
|
+
|
|
53
|
+
## How to update from md2md upstream
|
|
54
|
+
|
|
55
|
+
`md2md` is treated as a read-only reference per `plans/format-asciidoc-import.md`. There's no auto-sync. To pull a new revision:
|
|
56
|
+
|
|
57
|
+
1. Diff `~/dev/md2md/src/downdoc.js` against `packages/adoc2md-modular/src/engine.js`.
|
|
58
|
+
2. Apply the substantive changes (skipping the 4-line ESM patch above — those stay).
|
|
59
|
+
3. Re-run `pnpm --filter @dogsbay/adoc2md-modular test`.
|
|
60
|
+
4. Update this LINEAGE.md with the new source date + change summary.
|
|
61
|
+
|
|
62
|
+
## Attribution
|
|
63
|
+
|
|
64
|
+
- Upstream: [Dan Allen / downdoc](https://gitlab.com/antora/downdoc) — Apache-2.0.
|
|
65
|
+
- Prototype: `~/dev/md2md/src/downdoc.js` (the modified fork). md2md authors carried the upstream license.
|
|
66
|
+
- Phase 4 Dogsbay port: Gabriel McGoldrick (the same prototype author), 2026-05-13.
|
|
67
|
+
|
|
68
|
+
License is preserved as Apache-2.0 for `engine.js`; the rest of the package (`index.ts`, `engine.d.ts`, tests, docs) is MIT (the dogsbay default).
|
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# @dogsbay/adoc2md-modular
|
|
2
|
+
|
|
3
|
+
AsciiDoc → Markdown converter optimised for **modular-content** patterns: `include::` resolution, `:leveloffset:` adjustment, `ifdef::` conditionals, attribute substitution. Ported from the [`md2md`](https://github.com/dogsbay/md2md) prototype's `downdoc.js`; the per-file engine that `@dogsbay/format-asciidoc` builds on.
|
|
4
|
+
|
|
5
|
+
**Status:** live. The full converter (`src/engine.js`) is in production for the OpenShift migration; `index.ts` wraps it and exposes the public options. Zero runtime dependencies, ESM-only, published to npm.
|
|
6
|
+
|
|
7
|
+
## API
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { asciidocToMarkdown } from "@dogsbay/adoc2md-modular";
|
|
11
|
+
|
|
12
|
+
const md = asciidocToMarkdown(adocSource, {
|
|
13
|
+
attributes: { product: "AAP", version: "2.5" },
|
|
14
|
+
inlineIncludes: false, // default — emit {% include %}
|
|
15
|
+
dlistFormat: "markdown", // markdown | html | pandoc
|
|
16
|
+
admonitionFormat: "html", // html | mkdocs | docusaurus | github
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Output is Markdown with Minja directives embedded for unresolved variables and includes. Resolve them downstream with `@dogsbay/minja` (see `plans/format-asciidoc-import.md` Phase 2 for the `undefinedBehavior` modes that let unresolved attributes survive into the final artifact).
|
|
21
|
+
|
|
22
|
+
## CLI
|
|
23
|
+
|
|
24
|
+
A standalone `adoc2md` bin ships for converting **one file** without the full `dogsbay` CLI:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx @dogsbay/adoc2md-modular path/to/file.adoc > file.md # or: adoc2md file.adoc
|
|
28
|
+
cat file.adoc | adoc2md - --admonition-format docusaurus # stdin → stdout
|
|
29
|
+
adoc2md https://github.com/openshift/openshift-docs/blob/main/modules/about-crio.adoc
|
|
30
|
+
# ^ a URL works too; GitHub "blob" URLs are auto-rewritten to raw
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Input can be a file, `-`/stdin, or an `http(s)` URL — handy for demoing against real GitHub content. A remote file's *relative* `include::` directives stay as `{% include %}` (they can't be read off disk).
|
|
34
|
+
|
|
35
|
+
It is **translate-only** — the output keeps `{{ vars }}` / `{% if %}` / `{% include %}` directives. Attribute values and distro selection are a no-op at translate time, so the CLI intentionally doesn't accept them; supply them at the resolve step with [`@dogsbay/minja`](../minja) (a Jinja2/Nunjucks subset built for this):
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# 1. translate (this package)
|
|
39
|
+
adoc2md page.adoc -o page.md
|
|
40
|
+
# → Welcome to {{ product_title }} {{ product_version }}.
|
|
41
|
+
# → {% if openshift_enterprise %} … {% endif %}
|
|
42
|
+
|
|
43
|
+
# 2. resolve (minja) — values live here, not in step 1
|
|
44
|
+
npx @dogsbay/minja page.md -v '{"product_title":"OpenShift","product_version":"4.22","openshift_enterprise":true}'
|
|
45
|
+
# → Welcome to OpenShift 4.22.
|
|
46
|
+
# → (enterprise branch kept)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`minja` also accepts `-c <context.json|yaml>` and `-o <out.md>`. Any other Jinja2/Nunjucks-compatible engine works too, given the same variable names (hyphens become underscores: `{product-title}` → `{{ product_title }}`).
|
|
50
|
+
|
|
51
|
+
Flags mirror the API options that affect output: `-A/--admonition-format`, `-d/--dlist-format`, `--inline-includes`, `--base-path`, `--block-roles`, `--source-path`, `-o/--output`. Run `adoc2md --help` for details. For a whole corpus (topic-map nav, distro filtering, scaffolded site) use `dogsbay migrate-asciidoc` instead.
|
|
52
|
+
|
|
53
|
+
## Why a separate package?
|
|
54
|
+
|
|
55
|
+
Three concerns are intertwined in AsciiDoc import and each deserves its own surface:
|
|
56
|
+
|
|
57
|
+
1. **Per-file converter** (this package): AsciiDoc syntax → Markdown text. Pure function, no I/O, no corpus topology.
|
|
58
|
+
2. **Preprocessor** (`@dogsbay/minja`): variable + include resolution against an attribute context.
|
|
59
|
+
3. **Corpus loader** (`@dogsbay/format-asciidoc`): discovery + topology — which files exist, what variants apply, how nav is built. See `plans/asciidoc-corpus-loaders.md`.
|
|
60
|
+
|
|
61
|
+
Keeping the converter free of I/O and topology means it round-trips deterministically and stays easy to test against the md2md fixtures.
|
|
62
|
+
|
|
63
|
+
## Lineage
|
|
64
|
+
|
|
65
|
+
Forked from Dan Allen's [downdoc](https://gitlab.com/antora/downdoc) via the `md2md` prototype. See [`LINEAGE.md`](./LINEAGE.md) for the upstream fork point and enumerated local modifications.
|
|
66
|
+
|
|
67
|
+
## Roadmap
|
|
68
|
+
|
|
69
|
+
See [`plans/format-asciidoc-import.md`](../../plans/format-asciidoc-import.md) for the 8-phase rollout. This package owns Phases 3–5.
|
package/bin/adoc2md.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `adoc2md` — standalone single-file AsciiDoc → Markdown converter.
|
|
4
|
+
*
|
|
5
|
+
* A thin I/O wrapper around the pure `asciidocToMarkdown` engine so the
|
|
6
|
+
* package can be demoed without the full `dogsbay` CLI. Reads one `.adoc`
|
|
7
|
+
* file (or stdin), writes Markdown (or `-o <file>`).
|
|
8
|
+
*
|
|
9
|
+
* TRANSLATE-ONLY by design: the output keeps Minja/Jinja directives
|
|
10
|
+
* (`{{ vars }}`, `{% if %}`, `{% include %}`). Attribute VALUES and distro
|
|
11
|
+
* selection are deliberately NOT accepted here — the engine never
|
|
12
|
+
* substitutes them at translate time (they're a no-op on the output).
|
|
13
|
+
* Supply them at the resolve step instead, with `@dogsbay/minja`,
|
|
14
|
+
* Nunjucks, or Jinja2. This CLI only exposes knobs that change the
|
|
15
|
+
* translated Markdown.
|
|
16
|
+
*
|
|
17
|
+
* Zero runtime dependencies — only Node builtins.
|
|
18
|
+
*/
|
|
19
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
20
|
+
import { dirname } from "node:path";
|
|
21
|
+
import { parseArgs } from "node:util";
|
|
22
|
+
import { asciidocToMarkdown } from "../dist/index.js";
|
|
23
|
+
import { isHttpUrl, normalizeGitHubUrl } from "./url.js";
|
|
24
|
+
|
|
25
|
+
const HELP = `adoc2md — convert one AsciiDoc file to Markdown (with Minja directives)
|
|
26
|
+
|
|
27
|
+
USAGE
|
|
28
|
+
adoc2md <file.adoc> [options]
|
|
29
|
+
adoc2md <https://…/file.adoc> [options] fetch a URL (GitHub blob URLs
|
|
30
|
+
are auto-rewritten to raw)
|
|
31
|
+
adoc2md - [options] read AsciiDoc from stdin
|
|
32
|
+
cat file.adoc | adoc2md [options]
|
|
33
|
+
|
|
34
|
+
OPTIONS
|
|
35
|
+
-A, --admonition-format <fmt> html | mkdocs | docusaurus | github (default html)
|
|
36
|
+
-d, --dlist-format <fmt> markdown | html | pandoc (default markdown)
|
|
37
|
+
--inline-includes Splice include:: files in now instead of
|
|
38
|
+
emitting {% include %} directives.
|
|
39
|
+
--base-path <dir> Root for resolving include:: (default: the
|
|
40
|
+
input file's directory, or CWD for stdin).
|
|
41
|
+
--block-roles Emit [role]/[.role] as {.role} classes.
|
|
42
|
+
--source-path <slug> Docroot-relative slug → root-relative xrefs.
|
|
43
|
+
-o, --output <file> Write Markdown here instead of stdout.
|
|
44
|
+
-h, --help Show this help.
|
|
45
|
+
-v, --version Print version.
|
|
46
|
+
|
|
47
|
+
NOTES
|
|
48
|
+
Output is TRANSLATE-ONLY: {{ vars }} / {% if %} / {% include %} are
|
|
49
|
+
preserved. Attribute values and distro selection are a no-op at this
|
|
50
|
+
stage, so they aren't accepted here — resolve them downstream with
|
|
51
|
+
@dogsbay/minja (or another Jinja engine) and a context, e.g.
|
|
52
|
+
|
|
53
|
+
adoc2md page.adoc -o page.md
|
|
54
|
+
npx @dogsbay/minja page.md -v '{"product_title":"OpenShift","openshift_enterprise":true}'
|
|
55
|
+
# minja also takes -c <context.json|yaml> and -o <out.md>
|
|
56
|
+
|
|
57
|
+
A remote file's relative include:: directives can't be read from disk,
|
|
58
|
+
so they stay as {% include %} in the output (not spliced).
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
function fail(msg) {
|
|
62
|
+
process.stderr.write(`adoc2md: ${msg}\n`);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let parsed;
|
|
67
|
+
try {
|
|
68
|
+
parsed = parseArgs({
|
|
69
|
+
allowPositionals: true,
|
|
70
|
+
options: {
|
|
71
|
+
"admonition-format": { type: "string", short: "A" },
|
|
72
|
+
"dlist-format": { type: "string", short: "d" },
|
|
73
|
+
"inline-includes": { type: "boolean" },
|
|
74
|
+
"base-path": { type: "string" },
|
|
75
|
+
"block-roles": { type: "boolean" },
|
|
76
|
+
"source-path": { type: "string" },
|
|
77
|
+
output: { type: "string", short: "o" },
|
|
78
|
+
help: { type: "boolean", short: "h" },
|
|
79
|
+
version: { type: "boolean", short: "v" },
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
} catch (err) {
|
|
83
|
+
fail(err.message);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const { values, positionals } = parsed;
|
|
87
|
+
|
|
88
|
+
if (values.help) {
|
|
89
|
+
process.stdout.write(HELP);
|
|
90
|
+
process.exit(0);
|
|
91
|
+
}
|
|
92
|
+
if (values.version) {
|
|
93
|
+
const pkg = JSON.parse(
|
|
94
|
+
readFileSync(new URL("../package.json", import.meta.url), "utf8"),
|
|
95
|
+
);
|
|
96
|
+
process.stdout.write(`${pkg.version}\n`);
|
|
97
|
+
process.exit(0);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Resolve input: a URL, a positional file, or stdin ("-" or nothing).
|
|
101
|
+
const input = positionals[0];
|
|
102
|
+
let src;
|
|
103
|
+
let basePath;
|
|
104
|
+
if (isHttpUrl(input)) {
|
|
105
|
+
const url = normalizeGitHubUrl(input); // github blob → raw
|
|
106
|
+
let res;
|
|
107
|
+
try {
|
|
108
|
+
res = await fetch(url);
|
|
109
|
+
} catch (err) {
|
|
110
|
+
fail(`cannot fetch ${url}: ${err.message}`);
|
|
111
|
+
}
|
|
112
|
+
if (!res.ok) {
|
|
113
|
+
fail(`cannot fetch ${url}: HTTP ${res.status} ${res.statusText}`);
|
|
114
|
+
}
|
|
115
|
+
const contentType = res.headers.get("content-type") ?? "";
|
|
116
|
+
if (/\btext\/html\b/i.test(contentType)) {
|
|
117
|
+
fail(
|
|
118
|
+
`${url} returned HTML, not AsciiDoc — if this is a GitHub "blob" page, use the raw URL (raw.githubusercontent.com/…).`,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
src = await res.text();
|
|
122
|
+
// A remote file's relative include:: can't be read from disk, so they
|
|
123
|
+
// stay as {% include %} directives. --base-path is honoured if given.
|
|
124
|
+
basePath = values["base-path"] ?? process.cwd();
|
|
125
|
+
} else {
|
|
126
|
+
try {
|
|
127
|
+
if (input && input !== "-") {
|
|
128
|
+
src = readFileSync(input, "utf8");
|
|
129
|
+
basePath = values["base-path"] ?? dirname(input);
|
|
130
|
+
} else {
|
|
131
|
+
src = readFileSync(0, "utf8"); // fd 0 = stdin
|
|
132
|
+
basePath = values["base-path"] ?? process.cwd();
|
|
133
|
+
}
|
|
134
|
+
} catch (err) {
|
|
135
|
+
fail(`cannot read input: ${err.message}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let md;
|
|
140
|
+
try {
|
|
141
|
+
md = asciidocToMarkdown(src, {
|
|
142
|
+
basePath,
|
|
143
|
+
inlineIncludes: values["inline-includes"] ?? false,
|
|
144
|
+
dlistFormat: values["dlist-format"] ?? "markdown",
|
|
145
|
+
admonitionFormat: values["admonition-format"] ?? "html",
|
|
146
|
+
blockRoles: values["block-roles"] ?? false,
|
|
147
|
+
sourcePath: values["source-path"],
|
|
148
|
+
});
|
|
149
|
+
} catch (err) {
|
|
150
|
+
fail(`conversion failed: ${err.message}`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (values.output) {
|
|
154
|
+
writeFileSync(values.output, md);
|
|
155
|
+
} else {
|
|
156
|
+
process.stdout.write(md);
|
|
157
|
+
}
|
package/bin/url.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL helpers for the `adoc2md` CLI. Kept separate from the bin so the
|
|
3
|
+
* rewrite is unit-testable without spawning the process. Pure functions,
|
|
4
|
+
* zero dependencies.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** True for an `http://` / `https://` string. */
|
|
8
|
+
export function isHttpUrl(s) {
|
|
9
|
+
return typeof s === "string" && /^https?:\/\//i.test(s);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Rewrite a GitHub "blob" web URL to its raw.githubusercontent.com
|
|
14
|
+
* equivalent, so `adoc2md <url-pasted-from-the-browser>` fetches the
|
|
15
|
+
* AsciiDoc source instead of the HTML page. Non-blob / non-GitHub URLs
|
|
16
|
+
* pass through unchanged.
|
|
17
|
+
*
|
|
18
|
+
* https://github.com/OWNER/REPO/blob/REF/path/to/file.adoc
|
|
19
|
+
* → https://raw.githubusercontent.com/OWNER/REPO/REF/path/to/file.adoc
|
|
20
|
+
*
|
|
21
|
+
* REF may itself contain slashes (e.g. a `feature/x` branch); everything
|
|
22
|
+
* after `blob/` is preserved verbatim, matching GitHub's own mapping.
|
|
23
|
+
*/
|
|
24
|
+
export function normalizeGitHubUrl(url) {
|
|
25
|
+
const m = /^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/blob\/(.+)$/i.exec(url);
|
|
26
|
+
if (!m) return url;
|
|
27
|
+
const [, owner, repo, rest] = m;
|
|
28
|
+
return `https://raw.githubusercontent.com/${owner}/${repo}/${rest}`;
|
|
29
|
+
}
|
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default function downdoc(asciidoc: any, { attributes: initialAttrs, basePath, cleanupContinuation, nunjucksIncludes, dlistFormat, admonitionFormat, blockRoles, sourcePath, antora, antoraSlugPrefix, antoraComponents, falseAttributes, clampRowspans, includeRoot }?: {
|
|
2
|
+
attributes?: {} | undefined;
|
|
3
|
+
basePath?: null | undefined;
|
|
4
|
+
cleanupContinuation?: boolean | undefined;
|
|
5
|
+
nunjucksIncludes?: boolean | undefined;
|
|
6
|
+
dlistFormat?: string | undefined;
|
|
7
|
+
admonitionFormat?: string | undefined;
|
|
8
|
+
blockRoles?: boolean | undefined;
|
|
9
|
+
sourcePath?: null | undefined;
|
|
10
|
+
antora?: boolean | undefined;
|
|
11
|
+
antoraSlugPrefix?: null | undefined;
|
|
12
|
+
antoraComponents?: null | undefined;
|
|
13
|
+
falseAttributes?: never[] | undefined;
|
|
14
|
+
clampRowspans?: boolean | undefined;
|
|
15
|
+
includeRoot?: null | undefined;
|
|
16
|
+
}): any;
|
|
17
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.js"],"names":[],"mappings":"AAmjHA;;;;;;;;;;;;;;;QAy3CC"}
|