Enable HTML feature in docs generator (#5800)

This commit is contained in:
Laurenz 2025-02-03 18:06:45 +01:00 committed by GitHub
parent eee903b0f8
commit 5b3593e571
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,7 @@ use typst::foundations::{
AutoValue, Bytes, CastInfo, Category, Func, Module, NoneValue, ParamInfo, Repr, AutoValue, Bytes, CastInfo, Category, Func, Module, NoneValue, ParamInfo, Repr,
Scope, Smart, Type, Value, FOUNDATIONS, Scope, Smart, Type, Value, FOUNDATIONS,
}; };
use typst::html::HTML;
use typst::introspection::INTROSPECTION; use typst::introspection::INTROSPECTION;
use typst::layout::{Abs, Margin, PageElem, PagedDocument, LAYOUT}; use typst::layout::{Abs, Margin, PageElem, PagedDocument, LAYOUT};
use typst::loading::DATA_LOADING; use typst::loading::DATA_LOADING;
@ -31,7 +32,7 @@ use typst::symbols::SYMBOLS;
use typst::text::{Font, FontBook, TEXT}; use typst::text::{Font, FontBook, TEXT};
use typst::utils::LazyHash; use typst::utils::LazyHash;
use typst::visualize::VISUALIZE; use typst::visualize::VISUALIZE;
use typst::Library; use typst::{Feature, Library, LibraryBuilder};
macro_rules! load { macro_rules! load {
($path:literal) => { ($path:literal) => {
@ -57,7 +58,9 @@ static GROUPS: LazyLock<Vec<GroupData>> = LazyLock::new(|| {
}); });
static LIBRARY: LazyLock<LazyHash<Library>> = LazyLock::new(|| { static LIBRARY: LazyLock<LazyHash<Library>> = LazyLock::new(|| {
let mut lib = Library::default(); let mut lib = LibraryBuilder::default()
.with_features([Feature::Html].into_iter().collect())
.build();
let scope = lib.global.scope_mut(); let scope = lib.global.scope_mut();
// Add those types, so that they show up in the docs. // Add those types, so that they show up in the docs.
@ -166,6 +169,7 @@ fn reference_pages(resolver: &dyn Resolver) -> PageModel {
category_page(resolver, INTROSPECTION), category_page(resolver, INTROSPECTION),
category_page(resolver, DATA_LOADING), category_page(resolver, DATA_LOADING),
category_page(resolver, PDF), category_page(resolver, PDF),
category_page(resolver, HTML),
]; ];
page page
} }