Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
converters:
- '.github/workflows/ci.yml'
- 'converters/**'
- 'extensions/**'
- 'acdc-parser/**'
- 'Cargo.toml'
- 'Cargo.lock'
Expand All @@ -43,6 +44,7 @@ jobs:
- 'acdc-execute/**'
- 'acdc-parser/**'
- 'converters/**'
- 'extensions/**'
- 'Cargo.toml'
- 'Cargo.lock'
lsp:
Expand All @@ -62,6 +64,7 @@ jobs:
- '.github/workflows/ci.yml'
- 'converters/core/**'
- 'converters/pdf/**'
- 'extensions/lists/**'
- 'acdc-parser/**'
- 'Cargo.toml'
- 'Cargo.lock'
Expand Down Expand Up @@ -156,8 +159,10 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y groff mandoc
- name: Run converter tests
run: cargo nextest run -p acdc-converters-core -p acdc-converters-html -p acdc-converters-manpage -p acdc-converters-terminal -p acdc-converters-markdown --all-features --verbose
- name: Run converter and native extension tests
run: cargo nextest run -p acdc-converters-core -p acdc-converters-html -p acdc-converters-manpage -p acdc-converters-terminal -p acdc-converters-markdown -p acdc-extensions-lists --all-features --verbose
- name: Run native lists without optional capabilities
run: cargo nextest run -p acdc-extensions-lists --no-default-features --verbose
- name: Run HTML tests - no default features
run: cargo nextest run -p acdc-converters-html --no-default-features --verbose
- name: Run HTML tests - highlighting
Expand Down Expand Up @@ -201,6 +206,12 @@ jobs:
run: cargo nextest run -p acdc-cli -p acdc-execute --all-features --verbose --no-tests warn --test-threads 1 # we've added this until https://github.com/nextest-rs/nextest/pull/3553 gets merged
- name: Run execute-only tests
run: cargo nextest run -p acdc-cli -p acdc-execute --no-default-features --features execute --verbose --test-threads 1
- name: Test native lists availability and activation
run: |
cargo nextest run -p acdc-cli --no-default-features --features html --test lists --verbose
cargo nextest run -p acdc-cli --no-default-features --features html,lists --test lists --verbose
cargo nextest run -p acdc-cli --no-default-features --features terminal,lists -E 'test(pipeline_cli_native_lists)' --verbose
cargo check -p acdc-cli --no-default-features --features lists,network
- name: Test execute with the parser network capability
run: cargo nextest run -p acdc-execute --no-default-features --features acdc-parser/network -E 'test(substitution_is_independent_of_optional_capabilities)' --verbose
- name: Smoke-test backend-only CLI builds
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ crate; check the CLI manifest for backend and tool selection.
| `asg` | off | parser, CLI | Checked upstream and named acdc ASG export; independent of compatibility mode |
| `tck` | off | CLI | Fixed Draft-mode TCK adapter; enables `asg` |
| `network` | off | parser, html, pdf | Remote includes and HTML/PDF image access; caller permission and safe mode still apply |
| `lists` | off | CLI | Makes native `list-of` macros available; requires explicit `--extension lists` activation |
| `highlighting` | off | html, terminal | giallo source highlighting |
| `terminal` | off | html | Renders terminal previews into HTML; the cli exposes it as `html-terminal` |
| `emulator` | off | terminal | Runs terminal output through a libghostty-vt terminal emulator and captures the rendered screen grid (static previews + session replays); the cli exposes it as `terminal-emulator` |
Expand Down
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ members = [
"converters/pdf",
"converters/pdf/crates/*",
"converters/terminal",
"extensions/lists",
]
default-members = [
"acdc-cli",
Expand All @@ -31,6 +32,7 @@ default-members = [
"converters/pdf",
"converters/pdf/crates/*",
"converters/terminal",
"extensions/lists",
]
resolver = "2"

Expand All @@ -50,6 +52,7 @@ acdc-converters-terminal = { path = "converters/terminal", default-features = fa
acdc-execute = { path = "acdc-execute", default-features = false }
acdc-lint = { path = "acdc-lint", default-features = false }
acdc-parser = { path = "acdc-parser", default-features = false }
acdc-extensions-lists = { path = "extensions/lists", default-features = false }
base64 = "0.23"
chrono = "0.4"
clap = { version = "4.5", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion acdc-cli/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and explicit `subs=` settings work in every build. The former `pre-spec-subs`
and `setext` Cargo features and `--setext` flag are removed. Asciidoctor mode
supports Setext headings. See `acdc-parser/AGENTS.md` and `converters/AGENTS.md`.

`network` enables parser remote includes and forwards to selected execute, lint,
`network` enables parser remote includes and forwards to selected execute, lists, lint,
HTML and PDF crates. HTML/PDF image access still follows the converter's network
policy, caller permission and safe mode.

Expand Down
7 changes: 7 additions & 0 deletions acdc-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Selected native text postprocessors run per input, including when multiple terminal documents share a pager.

- Builds with the optional `lists` feature accept `convert --extension lists`
for native linked lists of document elements across enabled backends. Files,
stdin, and batches preserve formatted titles, stable links, and empty-section
options. Compilation alone leaves calls inactive; unavailable selections fail
before input is read. The Ruby `enhanced_rendering` option is intentionally
unsupported because acdc always preserves title formatting.

- Conversion accepts repeatable `--extension NAME` selections and rejects
unavailable packages before reading input. All input and output routes share
the backend-aware library pipeline.
Expand Down
4 changes: 3 additions & 1 deletion acdc-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ doc = false
[dependencies]
acdc-converters-core.workspace = true
acdc-execute = { workspace = true, optional = true }
acdc-extensions-lists = { workspace = true, optional = true }
acdc-converters-html = { workspace = true, optional = true }
acdc-lint = { workspace = true, optional = true }
acdc-parser.workspace = true
Expand Down Expand Up @@ -54,6 +55,7 @@ terminal = ["dep:acdc-converters-terminal"] # Terminal converter with ANSI co

# Document tools
lint = ["dep:acdc-lint"] # AsciiDoc lint command
lists = ["dep:acdc-extensions-lists"] # Native list-of block macros; activate with --extension lists

# Syntax highlighting for source blocks in selected HTML and terminal backends.
highlighting = [
Expand All @@ -77,7 +79,7 @@ asg = ["acdc-parser/asg"] # Checked upstream and acdc ASG expor
tck = ["asg"] # AsciiDoc Test Compatibility Kit adapter

# Network access
network = ["acdc-parser/network", "acdc-execute?/network", "acdc-lint?/network", "acdc-converters-pdf?/network", "acdc-converters-html?/network"] # Enable remote includes and embedded HTML/PDF images
network = ["acdc-parser/network", "acdc-execute?/network", "acdc-extensions-lists?/network", "acdc-lint?/network", "acdc-converters-pdf?/network", "acdc-converters-html?/network"] # Enable remote includes and embedded HTML/PDF images

# Feature groups for convenience
all-backends = ["html", "manpage", "markdown", "pdf", "terminal"] # Enable all output converters
Expand Down
25 changes: 25 additions & 0 deletions acdc-cli/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,27 @@ application. Repeat the option to select multiple packages in execution order;
duplicate selections count once. Compiling or registering a package does not
activate it. Unknown or unavailable names fail before input is read or parsed.

The optional `lists` build feature makes `--extension lists` available for every
compiled backend. Build it with `cargo build -p acdc-cli --features lists`, then:

[source,console]
....
acdc convert --extension lists document.adoc
acdc convert --backend pdf --extension lists document.adoc
printf 'list-of::section[]\n\n== First section\n' | acdc convert --extension lists --stdin -o -
....

Use `list-of::image[]`, `list-of::table[]`, or another supported element name to
generate linked entries, including targets later in the document. Authored IDs
are preserved; generated IDs are deterministic and collision-safe. Titles retain
their formatting and source-position attributes. `hide_empty_section=true` (or
the first positional argument) removes the nearest section when no matching
blocks exist. String values such as `false` still enable hiding, matching the
Ruby extension. Omit the argument to keep the section. The Ruby
`enhanced_rendering` toggle is unsupported because formatting is automatic;
remove it when migrating. See the link:../extensions/lists/README.adoc[lists guide]
for supported contexts, arguments, library registration, and reference differences.

Files, stdin, batches, terminal output, and pager output use the same pipeline.
The selected backend supplies attributes before preprocessing, and every document
gets fresh extension handlers. Library callers use
Expand Down Expand Up @@ -515,6 +536,10 @@ echo '{"contents":"= Hello","path":"test.adoc","type":"block"}' \
| no
| HTML terminal previews and session/replay rendering.

| `lists`
| no
| Makes native `list-of` macros available; select them with `--extension lists`.

| `terminal-emulator`
| no
| Ghostty-backed terminal session rendering; selects the terminal backend.
Expand Down
14 changes: 13 additions & 1 deletion acdc-cli/src/subcommands/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,19 @@ impl Args {
}

pub(crate) fn run(args: &Args) -> MietteResult<()> {
run_with_extensions(args, &ExtensionCatalog::default())
let available = ExtensionCatalog::default();
#[cfg(feature = "lists")]
let available = {
let mut available = available;
available
.register(
"lists",
acdc_extensions_lists::registry().map_err(|error| error::display(&error))?,
)
.map_err(|error| error::display(&error))?;
available
};
run_with_extensions(args, &available)
}

fn run_with_extensions(args: &Args, available: &ExtensionCatalog) -> MietteResult<()> {
Expand Down
49 changes: 49 additions & 0 deletions acdc-cli/src/subcommands/convert/pipeline_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,55 @@ fn pipeline_cli_terminal_reader_files_and_pager_share_processing() -> TestResult
Ok(())
}

#[cfg(all(feature = "lists", feature = "terminal", unix))]
#[test]
fn pipeline_cli_native_lists_use_terminal_reader_and_pager_paths() -> TestResult {
let directory = tempfile::tempdir()?;
let source = "list-of::quote[]\n\n.Native title\n[#target]\n[quote]\n____\nQuoted.\n____\n";
let input = directory.path().join("input.adoc");
let reader_output = directory.path().join("reader.txt");
let pager_output = directory.path().join("pager.txt");
std::fs::write(&input, source)?;
let mut catalog = ExtensionCatalog::default();
catalog.register("lists", acdc_extensions_lists::registry()?)?;
let selected = catalog.select(["lists"])?;
for mode in [
acdc_parser::CompatibilityMode::Asciidoctor,
acdc_parser::CompatibilityMode::Draft,
] {
let options = Options::builder()
.output_destination(OutputDestination::File(reader_output.clone()))
.build();
let converter = configure_pipeline(
acdc_converters_terminal::Converter::new(
options.clone(),
ParserOptions::builder().with_compatibility_mode(mode),
)?,
selected.as_ref(),
);
assert_eq!(
run_terminal_reader(&converter, source.as_bytes(), || None)?.warning_count,
0
);
let reader = std::fs::read_to_string(&reader_output)?;
assert_eq!(reader.matches("Native title").count(), 2, "{reader}");
assert!(!reader.contains("list-of::"));
let child = pager(&pager_output)?;
assert_eq!(
run_terminal_reader(&converter, source.as_bytes(), || Some(child))?.warning_count,
0
);
assert_eq!(std::fs::read_to_string(&pager_output)?, reader);
let child = pager(&pager_output)?;
assert_eq!(
run_terminal_through_pager(&converter, &options, std::slice::from_ref(&input), child)?,
0
);
assert_eq!(std::fs::read_to_string(&pager_output)?, reader);
}
Ok(())
}

/// A downstream converter chooses its own parser profile, serialization, and suffix.
struct NativeJson {
options: Options,
Expand Down
Loading
Loading