Description
EDIT (2025-05-26): This is currently stuck as the original way it was done was making the code more complex (zulip). Before this can continue, it needs design work to make sure that having the templates in Askama is nicer than the current format!
approach.
Tracking Issue for Rustdoc Askama Migration
This issue is to track the progress of migrating rustdoc's HTML rendering to Askama.
Suggested Workflow
If you'd like to work on a component, please leave a comment claiming it so that work doesn't conflict.
Work on translating the current series of format!()
and string building calls into an HTML template. Where possible, try to keep as much logic as possible on the Rust side. Make sure to refer to STYLE.md
for templating style, especially using comment blocks to minimize whitespace.
A specific example of a migration (and some style considerations) is here.
Components to Migrate
- Sidebar (rustdoc: Migrate sidebar rendering to Askama #108784)
- Content
- Stability/Portability/Deprecation (rustdoc: Migrate
document_item_info
to Askama #108757) - Item (
print_item.rs
)- Item Header
- Doc Block
- Modules
- Functions
- Traits
- Structs
- Unions (rustdoc: migrate item_union to an Askama template #109925)
- Enums
- Typedefs
- Macros
- ProcMacros (Migrate
item_proc_macro
to Askama #112031) - Primitives (Migrate
item_primitive
to Askama #112032) - Statics (bump minimum OS X version to 10.7 #11927)
- Constants
- Foreign Types (Migrate
item_foreign_type
to Askama #112005) Keywords- Opaque Types (Migrate
item_opaque_ty
to Askama #112034) - Trait Aliases (Migrate
item_trait_alias
to Askama #112030)
- Scraped examples
- Stability/Portability/Deprecation (rustdoc: Migrate
- Source View
- Line Numbers (Render source page layout with Askama #109187)
- Code Highlighting
Implementation History
- Use Tera templates for rustdoc. #86157
- Move top part of print_item to Tera templates #89695
- Migrate rustdoc from Tera to Askama #92526
@rustbot label +T-rustdoc +A-rustdoc-ui