Skip to content

Commit bacb1f0

Browse files
Myriad-Dreaminwinstonewert
authored andcommitted
feat: add pdf tags opts (Myriad-Dreamin#803)
1 parent a383fb0 commit bacb1f0

File tree

5 files changed

+47
-66
lines changed

5 files changed

+47
-66
lines changed

Cargo.lock

Lines changed: 22 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ vergen = { version = "9.0.1", features = [
192192
vergen-gitcl = { version = "1.0.1" }
193193

194194
# tinymist's world implementation
195-
typst-shim = { version = "0.14.0-rc1" }
196-
tinymist-std = { version = "0.14.0-rc1", default-features = false }
197-
tinymist-task = { version = "0.14.0-rc1", default-features = false }
198-
tinymist-world = { version = "0.14.0-rc1", default-features = false }
199-
tinymist-package = { version = "0.14.0-rc1", default-features = false }
200-
tinymist-project = { version = "0.14.0-rc1", default-features = false }
195+
typst-shim = { version = "0.14.0" }
196+
tinymist-std = { version = "0.14.0", default-features = false }
197+
tinymist-task = { version = "0.14.0", default-features = false }
198+
tinymist-world = { version = "0.14.0", default-features = false }
199+
tinymist-package = { version = "0.14.0", default-features = false }
200+
tinymist-project = { version = "0.14.0", default-features = false }
201201

202202
# project core
203203
reflexo = { version = "0.7.0-rc1", path = "crates/reflexo", default-features = false }
@@ -265,13 +265,13 @@ typst-html = { git = "https://github.com/Myriad-Dreamin/typst.git", tag = "typst
265265

266266
# fontdb = { path = "../fontdb" }
267267

268-
# typst-shim = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "bc5b26f7892326e886ba4b1e28281c9303f512cd" }
269-
# tinymist-derive = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "bc5b26f7892326e886ba4b1e28281c9303f512cd" }
270-
# tinymist-std = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "bc5b26f7892326e886ba4b1e28281c9303f512cd" }
271-
# tinymist-task = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "bc5b26f7892326e886ba4b1e28281c9303f512cd" }
272-
# tinymist-package = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "bc5b26f7892326e886ba4b1e28281c9303f512cd" }
273-
# tinymist-world = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "bc5b26f7892326e886ba4b1e28281c9303f512cd" }
274-
# tinymist-project = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "bc5b26f7892326e886ba4b1e28281c9303f512cd" }
268+
typst-shim = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "052149a509b686fa9111dd99eb278ce1213abdf2" }
269+
tinymist-derive = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "052149a509b686fa9111dd99eb278ce1213abdf2" }
270+
tinymist-std = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "052149a509b686fa9111dd99eb278ce1213abdf2" }
271+
tinymist-task = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "052149a509b686fa9111dd99eb278ce1213abdf2" }
272+
tinymist-package = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "052149a509b686fa9111dd99eb278ce1213abdf2" }
273+
tinymist-world = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "052149a509b686fa9111dd99eb278ce1213abdf2" }
274+
tinymist-project = { git = "https://github.com/Myriad-Dreamin/tinymist.git", rev = "052149a509b686fa9111dd99eb278ce1213abdf2" }
275275

276276
# typst-shim = { path = "../tinymist/crates/typst-shim" }
277277
# tinymist-derive = { path = "../tinymist/crates/tinymist-derive" }

packages/typst.node/src/compiler/node.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,12 @@ impl NodeCompiler {
292292
.context("failed to deserialize PdfStandard for typst")
293293
.map_err(map_node_error)?;
294294

295+
let pdf_tags = opts.pdf_tags.unwrap_or(true);
296+
295297
ExportPdfTask {
296298
export: Default::default(),
297299
pdf_standards: standard.into_iter().collect(),
300+
no_pdf_tags: !pdf_tags,
298301
creation_timestamp,
299302
pages: None,
300303
}

packages/typst.node/src/compiler/project.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,12 @@ impl NodeTypstProject {
667667
.context("failed to deserialize PdfStandard for typst")
668668
.map_err(map_node_error)?;
669669

670+
let pdf_tags = opts.pdf_tags.unwrap_or(true);
671+
670672
ExportPdfTask {
671673
export: Default::default(),
672674
pdf_standards: standard.into_iter().collect(),
675+
no_pdf_tags: !pdf_tags,
673676
creation_timestamp,
674677
pages: None,
675678
}

packages/typst.node/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ pub struct RenderPdfOpts {
191191
/// standards.
192192
pub pdf_standard: Option<String>,
193193

194+
/// By default, even when not producing a `PDF/UA-1` document, a tagged PDF
195+
/// document is written to provide a baseline of accessibility. In some
196+
/// circumstances (for example when trying to reduce the size of a document)
197+
/// it can be desirable to disable tagged PDF.
198+
pub pdf_tags: Option<bool>,
199+
194200
/// An optional (creation) timestamp to be used to export PDF, *in seconds*.
195201
///
196202
/// This is used when you *enable auto timestamp* in the document.

0 commit comments

Comments
 (0)