A tool to generate a PDF version of The Swift Programming Language book.
Project description
PDF Generator for The Swift Programming Language
Convert the DocC source for The Swift Programming Language book into a print-ready PDF document. The final document follows the DocC rendering style and retains all internal references and external links.
| Preview Books (see swift-book-archive for versioned archives) | ||
| Digital Mode Clickable links, best for on-screen reading |
Print Mode Page numbers & full URLs, best for printing |
|
| Light Mode | ||
| Dark Mode | ||
Features
- Generate a PDF version of the The Swift Programming Language book, perfect for offline browsing or printing.
- Choose from one of two rendering modes:
- Digital mode with hyperlinks for cross-references between chapters and external links.
- Print mode with page numbers accompanying cross-references between chapters and full URLs shown in footnotes for external links.
- Both versions follow the DocC rendering style used in docs.swift.org, including code highlighting.
Requirements
- Python 3.9+
- Git
- LuaTeX. If you don't have an existing LaTeX installation, see MacTeX, TeX Live, or MiKTeX.
- Fonts for typesetting. Learn which fonts are required to typeset the TSPL book.
Installation
Latest PyPI stable release
pip install swift-book-pdf
Usage
Basic usage
Call swift_book_pdf without any arguments to save the resulting PDF as swift_book.pdf in the current directory. The package defaults to the digital rendering mode in Letter paper size.
$ swift_book_pdf
[INFO]: Downloading TSPL files...
[INFO]: Creating PDF in digital (light) mode...
[INFO]: PDF saved to ./swift-book.pdf
When invoked, swift_book_pdf will:
- Clone the
swift-bookrepository - Convert all Markdown source files into a single LaTeX document
- Render the LaTeX document into the final PDF document
[!NOTE] swift_book_pdf will create a temporary directory to store the swift-book repository, LaTeX file and intermediate files produced during typesetting. This temporary directory is removed after the PDF is generated.
Customization
swift-book-pdf offers a range of options to customize your rendering of The Swift Programming Language book. Learn how to make the TSPL book your own.
Acknowledgments
At runtime, the swift-book repository is temporarily cloned for processing, but no part of the repository is directly redistributed here.
chapter-icon.png and chapter-icon~dark.png are derived from the ArticleIcon.vue component in the swift-docc-render repository.
The swift-book and swift-docc-render repositories are part of the Swift.org open source project, which is licensed under the Apache License v2.0 with Runtime Library Exception. See https://swift.org/LICENSE.txt for more details. The Swift project authors are credited at https://swift.org/CONTRIBUTORS.txt.
The Swift logo is a trademark of Apple Inc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swift_book_pdf-2.0.0.tar.gz.
File metadata
- Download URL: swift_book_pdf-2.0.0.tar.gz
- Upload date:
- Size: 376.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a59eb46ceb70903441c5fb17b1830d8e923a97b0da53913b10f87153d9e900c5
|
|
| MD5 |
8bf296eda8ce7a11ff2bc179aafcfef8
|
|
| BLAKE2b-256 |
d5ce1eaadd98905df3e91a55a08f55fe660657f223bb7adc3ff3dac591b237d4
|
Provenance
The following attestation bundles were made for swift_book_pdf-2.0.0.tar.gz:
Publisher:
release.yml on ekassos/swift-book-pdf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swift_book_pdf-2.0.0.tar.gz -
Subject digest:
a59eb46ceb70903441c5fb17b1830d8e923a97b0da53913b10f87153d9e900c5 - Sigstore transparency entry: 782416760
- Sigstore integration time:
-
Permalink:
ekassos/swift-book-pdf@e4b73514b31928fc25a4103facb06482d9f96849 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/ekassos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e4b73514b31928fc25a4103facb06482d9f96849 -
Trigger Event:
release
-
Statement type:
File details
Details for the file swift_book_pdf-2.0.0-py3-none-any.whl.
File metadata
- Download URL: swift_book_pdf-2.0.0-py3-none-any.whl
- Upload date:
- Size: 391.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f16d1745bd4fde8b94726e473b04f587cd2fd8c592e993e26a97d751587b9464
|
|
| MD5 |
3022bf2d4a8110547c71b021695c6fc7
|
|
| BLAKE2b-256 |
f39545053013ee342f644a497207c85021585399afde41768c4a4c333d4dc136
|
Provenance
The following attestation bundles were made for swift_book_pdf-2.0.0-py3-none-any.whl:
Publisher:
release.yml on ekassos/swift-book-pdf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swift_book_pdf-2.0.0-py3-none-any.whl -
Subject digest:
f16d1745bd4fde8b94726e473b04f587cd2fd8c592e993e26a97d751587b9464 - Sigstore transparency entry: 782416761
- Sigstore integration time:
-
Permalink:
ekassos/swift-book-pdf@e4b73514b31928fc25a4103facb06482d9f96849 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/ekassos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e4b73514b31928fc25a4103facb06482d9f96849 -
Trigger Event:
release
-
Statement type: