PDF backend for asciidoctor.mbt: a port of Asciidoctor PDF 2.3.27 with its themes and fonts bundled
Dependencies
moonx bobzhang/asciidoctor-pdf/cmd/asciidoctor-pdf doc.adocmoon -C pdf build --target native --release
pdf/_build/native/release/build/bobzhang/asciidoctor-pdf/cmd/asciidoctor-pdf/asciidoctor-pdf.exe doc.adocasciidoctor-pdf doc.adoc # writes doc.pdf next to doc.adoc
asciidoctor-pdf -o out.pdf doc.adoc # -o - writes the PDF to standard output
asciidoctor-pdf -D build -a toc doc.adoc # writes build/doc.pdf
asciidoctor-pdf --theme default-sans doc.adoc # or -a pdf-theme=my-theme.yml -a pdf-themesdir=themes
asciidoctor-pdf -d book -S safe doc.adoc
cat doc.adoc | asciidoctor-pdf - > doc.pdf # standard input to standard output
asciidoctor-pdf --help # all options///|
test "convert a document to PDF" {
@asciidoctor_pdf.register()
let doc = @asciidoctor.load(
(
#|= Hello, PDF
#|
#|A paragraph with *strong* text.
),
options=@core.Options::new(backend="pdf", standalone=true),
)
let pdf = @asciidoctor_pdf.convert(doc)
assert_eq(pdf[0:5].to_owned(), b"%PDF-")
}| Package | Fonts | Needed for |
|---|---|---|
| bobzhang/asciidoctor-pdf/fonts | Noto Serif, M+ 1mn | the default theme (always) |
| bobzhang/asciidoctor-pdf/fonts/sans | Noto Sans | default-sans |
| bobzhang/asciidoctor-pdf/fonts/fallback | M+ 1p Fallback, Noto Emoji | default-with-font-fallbacks |
| bobzhang/asciidoctor-pdf/fonts/icons | Font Awesome 5, Foundation Icons, PaymentFont | icons=font |
///|
test "a theme with fonts of another package" {
@asciidoctor_pdf.register(fonts=[@bundled.default_fonts(), @sans.fonts()])
let doc = @asciidoctor.load(
"Set in Noto Sans.",
options=@core.Options::new(backend="pdf", standalone=true, attributes=[
("pdf-theme", Str("default-sans")),
]),
)
assert_eq(@asciidoctor_pdf.convert(doc)[0:5].to_owned(), b"%PDF-")
}pub struct FontCatalog {
// private fields
}fn FontCatalog::load(files : Array[(String, Bool, Bool, Bytes)], icon_sets? : Array[IconSet], legacy_icon_mapping? : String, fallbacks? : Array[String]) -> FontCatalog raisepub(all) struct IconSet {
name : String
font : Bytes
legend : String
}let version : StringInstall
Download zipPDF backend for asciidoctor.mbt: a port of Asciidoctor PDF 2.3.27 with its themes and fonts bundled
Dependencies