Test cases / md

deft md to-pdf

Typeset Markdown as PDF

5 runs on real files, 14 tests on generated files, not shown. 0 failed.

Fixed cases

Generated files, compared with ground truth by tools other than deft.

Chinese MarkdownPassed

deft md to-pdf books.md -o out.pdf

Input

books.md 45.2 KB
免费的编程中文书籍索引
============================

[![](https://img.shields.io/github/issues/justjavac/free-programming-books-zh_CN.svg)](https://github.com/justjavac/free-programming-books-zh_CN/issues)  [![](https://img.shields.io/github/forks/justjavac/free-programming-books-zh_CN.svg)](https://github.com/justjavac/free-programming-books-zh_CN/network) [![](https://img.shields.io/github/stars/justjavac/free-programming-books-zh_CN.svg)](https://github.com/justjavac/free-programming-books-zh_CN/stargazers) [![](https://travis-ci.org/justjavac/free-programming-books-zh_CN.svg?branch=master)](https://travis-ci.org/justjavac/free-programming-books-zh_CN) [![](https://img.shields.io/github/release/justjavac/free-programming-books-zh_CN.svg)](https://github.com/justjavac/free-programming-books-zh_CN/releases)

免费的编程中文书籍索引,欢迎投稿。

- 国外程序员在 [stackoverflow](http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read/1713%231713) 推荐的程序员必读书籍,[中文版](http://justjavac.com/other/2012/05/15/qualified-programmer-should-read-what-books.html "一个合格的程序员应该读过哪些书")。
- 程序员应该阅读的非编程类书籍有哪些? [中文版](what-non-programming-books-should-programmers-read.md)(原帖为 stackoverflow 上已删除的[问题 38210](https://web.archive.org/web/20170103152138/http://stackoverflow.com/questions/38210/what-non-programming-books-should-programmers-read))
- [github](https://github.com/EbookFoundation/free-programming-books) 上的一个流行的编程书籍索引  [中文版](https://github.com/EbookFoundation/free-programming-books/blob/main/books/free-programming-books-zh.md)

如果这个仓库对你有帮助,欢迎 star。如果这个仓库帮你提升了技能找到了工作,可以请我喝杯咖啡:

<p align="center"><img src="https://dl.deno.js.cn/buy-me-a-coffee-wechat.png" width="320" height="320" alt="" /></p>

## 参与交流

欢迎大家将珍藏已久的经典免费书籍共享出来,您可以:

* 使用 [Pull Request](https://github.com/justjavac/free-programming-books-zh_CN/pulls) 提交

如果你发现了不能访问的链接,也可以提 PR,在无法访问链接的后面增加 `:worried:`。

贡献者名单: https://github.com/justjavac/free-programming-books-zh_CN/graphs/contributors

## 目录

* 语言无关类
  * [操作系统](#操作系统)
  * [AI](#ai)
  * [智能系统](#智能系统)
  * [分布式系统](#分布式系统)
  * [编译原理](#编译原理)
  * [函数式概念](#函数式概念)
  * [计算机图形学](#计算机图形学)
  * [WEB服务器](#web服务器)
  * [版本控制](#版本控制)
  * [编辑器](#编辑器)
  * [NoSQL](#nosql)
  * [PostgreSQL](#postgresql)
  * [MySQL](#mysql)
  * [管理和监控](#管理和监控)
  * [项目相关](#项目相关)
  * [设计模式](#设计模式)
  * [Web](#web)
  * [大数据](#大数据)
  * [编程艺术](#编程艺术)
  * [游戏引擎](#游戏引擎)
  * [算法](#算法)
  * [其它](#其它)

* 语言相关类
  * [Android](#android)
  * [APP](#app)
  * [AWK](#awk)
  * [C/C++](#cc)
  * [C#](#c)
  * [Clojure](#clojure)
  * [CSS/HTML](#csshtml)
  * [Elixir](#elixir)
  * [Fortran](#fortran)
  * [Go](#go)
  * [Haskell](#haskell)
  * [iOS](#ios)
  * [Java](#java)
  * [JavaScript](#javascript)
  * [Kotlin](#kotlin)
  * [LaTeX](#latex)
  * [LISP](#lisp)
  * [Lua](#lua)
  * [OCaml](#OCaml)
  * [Perl](#perl)
  * [PHP](#php)
  * [Prolog](#prolog)
  * [Python](#python)
  * [R](#r)
  * [Ruby](#ruby)
  * [Rust](#rust)
  * [Scala](#scala)
  * [Shell](#shell)
  * [Swift](#swift)

* [读书笔记及其它](#读书笔记及其它)
* 
… 36052 more characters

Output

out.pdf 898.6 KB · 19 pages
Page 1Page 2Page 3
What it printed
ok md.to-pdf books.md -> out.pdf  19 pages  5.65s
warning: raw HTML is skipped in PDF output
warning: 1 web picture could not be downloaded and is left out, keeping any alt text: https://travis-ci.org/justjavac/free-programming-books-zh_CN.svg?branch=master
Automatic checks (1)
  • pdf_page: file = "out.pdf", ink_min = 0.001, page = 1

Real-file tasks

Real files and a plain-language job, from the agent benchmark. These are the reference answers, not an agent run.

Chinese Markdown to PDFPassed

把 books.md 转成 PDF,保存为 books.pdf,中文必须正常显示。

deft md to-pdf books.md -o books.pdf

Input

books.md 45.2 KB
免费的编程中文书籍索引
============================

[![](https://img.shields.io/github/issues/justjavac/free-programming-books-zh_CN.svg)](https://github.com/justjavac/free-programming-books-zh_CN/issues)  [![](https://img.shields.io/github/forks/justjavac/free-programming-books-zh_CN.svg)](https://github.com/justjavac/free-programming-books-zh_CN/network) [![](https://img.shields.io/github/stars/justjavac/free-programming-books-zh_CN.svg)](https://github.com/justjavac/free-programming-books-zh_CN/stargazers) [![](https://travis-ci.org/justjavac/free-programming-books-zh_CN.svg?branch=master)](https://travis-ci.org/justjavac/free-programming-books-zh_CN) [![](https://img.shields.io/github/release/justjavac/free-programming-books-zh_CN.svg)](https://github.com/justjavac/free-programming-books-zh_CN/releases)

免费的编程中文书籍索引,欢迎投稿。

- 国外程序员在 [stackoverflow](http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read/1713%231713) 推荐的程序员必读书籍,[中文版](http://justjavac.com/other/2012/05/15/qualified-programmer-should-read-what-books.html "一个合格的程序员应该读过哪些书")。
- 程序员应该阅读的非编程类书籍有哪些? [中文版](what-non-programming-books-should-programmers-read.md)(原帖为 stackoverflow 上已删除的[问题 38210](https://web.archive.org/web/20170103152138/http://stackoverflow.com/questions/38210/what-non-programming-books-should-programmers-read))
- [github](https://github.com/EbookFoundation/free-programming-books) 上的一个流行的编程书籍索引  [中文版](https://github.com/EbookFoundation/free-programming-books/blob/main/books/free-programming-books-zh.md)

如果这个仓库对你有帮助,欢迎 star。如果这个仓库帮你提升了技能找到了工作,可以请我喝杯咖啡:

<p align="center"><img src="https://dl.deno.js.cn/buy-me-a-coffee-wechat.png" width="320" height="320" alt="" /></p>

## 参与交流

欢迎大家将珍藏已久的经典免费书籍共享出来,您可以:

* 使用 [Pull Request](https://github.com/justjavac/free-programming-books-zh_CN/pulls) 提交

如果你发现了不能访问的链接,也可以提 PR,在无法访问链接的后面增加 `:worried:`。

贡献者名单: https://github.com/justjavac/free-programming-books-zh_CN/graphs/contributors

## 目录

* 语言无关类
  * [操作系统](#操作系统)
  * [AI](#ai)
  * [智能系统](#智能系统)
  * [分布式系统](#分布式系统)
  * [编译原理](#编译原理)
  * [函数式概念](#函数式概念)
  * [计算机图形学](#计算机图形学)
  * [WEB服务器](#web服务器)
  * [版本控制](#版本控制)
  * [编辑器](#编辑器)
  * [NoSQL](#nosql)
  * [PostgreSQL](#postgresql)
  * [MySQL](#mysql)
  * [管理和监控](#管理和监控)
  * [项目相关](#项目相关)
  * [设计模式](#设计模式)
  * [Web](#web)
  * [大数据](#大数据)
  * [编程艺术](#编程艺术)
  * [游戏引擎](#游戏引擎)
  * [算法](#算法)
  * [其它](#其它)

* 语言相关类
  * [Android](#android)
  * [APP](#app)
  * [AWK](#awk)
  * [C/C++](#cc)
  * [C#](#c)
  * [Clojure](#clojure)
  * [CSS/HTML](#csshtml)
  * [Elixir](#elixir)
  * [Fortran](#fortran)
  * [Go](#go)
  * [Haskell](#haskell)
  * [iOS](#ios)
  * [Java](#java)
  * [JavaScript](#javascript)
  * [Kotlin](#kotlin)
  * [LaTeX](#latex)
  * [LISP](#lisp)
  * [Lua](#lua)
  * [OCaml](#OCaml)
  * [Perl](#perl)
  * [PHP](#php)
  * [Prolog](#prolog)
  * [Python](#python)
  * [R](#r)
  * [Ruby](#ruby)
  * [Rust](#rust)
  * [Scala](#scala)
  * [Shell](#shell)
  * [Swift](#swift)

* [读书笔记及其它](#读书笔记及其它)
* 
… 36052 more characters

Output

books.pdf 898.6 KB · 19 pages
Page 1Page 2Page 3
Automatic checks (2)
  • pdf_text: file = "books.pdf", contains = ["编程"]
  • pdf_page: file = "books.pdf", page = 1, ink_min = 0.01

README to PDFPassed

Render rust-readme.md as a nicely formatted PDF called readme.pdf.

deft md to-pdf rust-readme.md -o readme.pdf

Input

<div align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rust-lang/www.rust-lang.org/master/static/images/rust-social-wide-dark.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/rust-lang/www.rust-lang.org/master/static/images/rust-social-wide-light.svg">
    <img alt="The Rust Programming Language: A language empowering everyone to build reliable and efficient software"
         src="https://raw.githubusercontent.com/rust-lang/www.rust-lang.org/master/static/images/rust-social-wide-light.svg"
         width="50%">
  </picture>

[Website][Rust] | [Getting started] | [Learn] | [Documentation] | [Contributing]
</div>

This is the main source code repository for [Rust]. It contains the compiler,
standard library, and documentation.

[Rust]: https://www.rust-lang.org/
[Getting Started]: https://www.rust-lang.org/learn/get-started
[Learn]: https://www.rust-lang.org/learn
[Documentation]: https://www.rust-lang.org/learn#learn-use
[Contributing]: CONTRIBUTING.md

## Why Rust?

- **Performance:** Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrated with other languages.

- **Reliability:** Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time.

- **Productivity:** Comprehensive documentation, a compiler committed to providing great diagnostics, and advanced tooling including package manager and build tool ([Cargo]), auto-formatter ([rustfmt]), linter ([Clippy]) and editor support ([rust-analyzer]).

[Cargo]: https://github.com/rust-lang/cargo
[rustfmt]: https://github.com/rust-lang/rustfmt
[Clippy]: https://github.com/rust-lang/rust-clippy
[rust-analyzer]: https://github.com/rust-lang/rust-analyzer

## Quick Start

Read ["Installation"] from [The Book].

["Installation"]: https://doc.rust-lang.org/book/ch01-01-installation.html
[The Book]: https://doc.rust-lang.org/book/index.html

## Installing from Source

If you really want to install from source (though this is not recommended), see
[INSTALL.md](INSTALL.md).

## Getting Help

See https://www.rust-lang.org/community for a list of chat platforms and forums.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).

For a detailed explanation of the compiler's architecture and how to begin contributing, see the [rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/).

## License

Rust is primarily distributed under the terms of both the MIT license and the
Apache License (Version 2.0), with portions covered by various BSD-like
licenses.

See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and
[COPYRIGHT](COPYRIGHT) for details.

## Trademark

[The Rust Foundation][rust-foundation] owns and protects the Rust and Cargo
trademarks and logos (the "Rust Trademarks").

If you want to use these names or brands, please read the
[Rust language trademark policy][trademark-policy].

Third-pa
… 304 more characters

Output

readme.pdf 34.1 KB · 1 page
Page 1
Automatic checks (2)
  • pdf_text: file = "readme.pdf", contains = ["Rust"]
  • pdf_page: file = "readme.pdf", page = 1, ink_min = 0.01

Report with an image and tablePassed

Render report.md as report.pdf. The charts it shows from doc/images must appear in the PDF.

deft md to-pdf report.md -o report.pdf

Input

doc/images/CSpeed2.png 71.6 KB · 1325x741
doc/images/CSpeed2.png
doc/images/DCspeed5.png 67.7 KB · 1670x705
doc/images/DCspeed5.png
doc/images/DSpeed3.png 26.5 KB · 606x733
doc/images/DSpeed3.png
doc/images/dict-cr.png 88.3 KB · 408x700
doc/images/dict-cr.png
doc/images/dict-cs.png 89.4 KB · 408x700
doc/images/dict-cs.png
doc/images/dict-ds.png 96.0 KB · 408x702
doc/images/dict-ds.png
report.md 11.6 KB
<p align="center"><img src="https://raw.githubusercontent.com/facebook/zstd/dev/doc/images/zstd_logo86.png" alt="Zstandard"></p>

__Zstandard__, or `zstd` as short version, is a fast lossless compression algorithm,
targeting real-time compression scenarios at zlib-level and better compression ratios.
It's backed by a very fast entropy stage, provided by [Huff0 and FSE library](https://github.com/Cyan4973/FiniteStateEntropy).

Zstandard's format is stable and documented in [RFC8878](https://datatracker.ietf.org/doc/html/rfc8878). Multiple independent implementations are already available.
This repository represents the reference implementation, provided as an open-source dual [BSD](LICENSE) OR [GPLv2](COPYING) licensed **C** library,
and a command line utility producing and decoding `.zst`, `.gz`, `.xz` and `.lz4` files.
Should your project require another programming language,
a list of known ports and bindings is provided on [Zstandard homepage](https://facebook.github.io/zstd/#other-languages).

**Development branch status:**

[![Build Status][travisDevBadge]][travisLink]
[![Build status][CircleDevBadge]][CircleLink]
[![Build status][CirrusDevBadge]][CirrusLink]
[![Fuzzing Status][OSSFuzzBadge]][OSSFuzzLink]

[travisDevBadge]: https://api.travis-ci.com/facebook/zstd.svg?branch=dev "Continuous Integration test suite"
[travisLink]: https://travis-ci.com/facebook/zstd
[CircleDevBadge]: https://circleci.com/gh/facebook/zstd/tree/dev.svg?style=shield "Short test suite"
[CircleLink]: https://circleci.com/gh/facebook/zstd
[CirrusDevBadge]: https://api.cirrus-ci.com/github/facebook/zstd.svg?branch=dev
[CirrusLink]: https://cirrus-ci.com/github/facebook/zstd
[OSSFuzzBadge]: https://oss-fuzz-build-logs.storage.googleapis.com/badges/zstd.svg
[OSSFuzzLink]: https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:zstd

## Benchmarks

For reference, several fast compression algorithms were tested and compared
on a desktop featuring a Core i7-9700K CPU @ 4.9GHz
and running Ubuntu 24.04 (`Linux 6.8.0-53-generic`),
using [lzbench], an open-source in-memory benchmark by @inikep
compiled with [gcc] 14.2.0,
on the [Silesia compression corpus].

[lzbench]: https://github.com/inikep/lzbench
[Silesia compression corpus]: https://sun.aei.polsl.pl//~sdeor/index.php?page=silesia
[gcc]: https://gcc.gnu.org/

| Compressor name         | Ratio | Compression| Decompress.|
| ---------------         | ------| -----------| ---------- |
| **zstd 1.5.7 -1**       | 2.896 |   510 MB/s |  1550 MB/s |
| brotli 1.1.0 -1         | 2.883 |   290 MB/s |   425 MB/s |
| [zlib] 1.3.1 -1         | 2.743 |   105 MB/s |   390 MB/s |
| **zstd 1.5.7 --fast=1** | 2.439 |   545 MB/s |  1850 MB/s |
| quicklz 1.5.0 -1        | 2.238 |   520 MB/s |   750 MB/s |
| **zstd 1.5.7 --fast=4** | 2.146 |   665 MB/s |  2050 MB/s |
| lzo1x 2.10 -1           | 2.106 |   650 MB/s |   780 MB/s |
| [lz4] 1.10.0            | 2.101 |   675 MB/s |  3850 MB/s |
| snappy 1.2.1            | 2.089 | 
… 8836 more characters

Output

_p01.png 14.6 KB · 331x468
_p01.png
_p02.png 12.3 KB · 331x468
_p02.png
_p03.png 17.2 KB · 331x468
_p03.png
_p04.png 10.3 KB · 331x468
_p04.png
_p05.png 9.7 KB · 331x468
_p05.png
report.pdf 329.2 KB · 5 pages
Page 1Page 2Page 3
Automatic checks (2)
  • pdf_text: file = "report.pdf", contains = ["Zstandard", "Benchmarks"]
  • python: code = "import glob, subprocess\nfrom PIL import Image\n# The charts are the only coloured things in the README; text and tables are black.\nsubprocess.check_call(['gs', '-q', '-dSAFER', '-dBATCH', '-dNOPAUSE', '-sDEVICE=png16m', '-r40', '-o', '_p%02d.png', 'report.pdf'])\ncoloured = 0\nfor f in glob.glob('_p*.png'):\n im = Image.open(f).convert('RGB')\n coloured += sum(1 for r, g, b in im.getdata() if max(r, g, b) - min(r, g, b) > 60)\nassert coloured > 2000, f'only {coloured} coloured pixels: the charts are missing'\n"

Turn a workbook into a reportPassed

Send the numbers in temperature.xlsx to a client as a PDF with a proper table, temperature.pdf, and give me a Word copy, temperature.docx, that I can edit.

deft sheet to-md temperature.xlsx -o table.md
deft md to-pdf table.md -o temperature.pdf
deft md to-docx table.md -o temperature.docx

Input

Rendered by macOS Quick Look, first page

Rendered by macOS Quick Look, first page

Output

| label | value |
| --- | --- |
| celsius | 22.2222 |
| fahrenheit | 72 |
Rendered by macOS Quick Look, first page

Rendered by macOS Quick Look, first page

Text inside
label
value
celsius
22.2222
fahrenheit
72

temperature.pdf 8.1 KB · 1 page
Page 1
Automatic checks (1)
  • python: code = "import subprocess, zipfile\npdf = subprocess.run(['gs', '-q', '-dNOPAUSE', '-dBATCH', '-sDEVICE=txtwrite', '-sOutputFile=-', 'temperature.pdf'], capture_output=True, text=True, errors='replace').stdout\nassert '22.2222' in pdf and '72' in pdf, pdf\ndoc = zipfile.ZipFile('temperature.docx').read('word/document.xml').decode()\nassert '<w:tbl>' in doc and '22.2222' in doc and '72' in doc\n"