Adapt docs infrastructure
This commit is contained in:
parent
615b1eacc7
commit
22052f4b59
@ -2,7 +2,7 @@ use std::cmp::Reverse;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Write;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::{Html, Resolver};
|
||||
|
||||
@ -73,13 +73,13 @@ struct Contributor {
|
||||
}
|
||||
|
||||
/// A commit on the `typst` repository.
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Commit {
|
||||
author: Author,
|
||||
}
|
||||
|
||||
/// A commit author.
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Author {
|
||||
login: String,
|
||||
avatar_url: String,
|
||||
|
@ -446,7 +446,8 @@ fn code_block(resolver: &dyn Resolver, lang: &str, text: &str) -> Html {
|
||||
frames.truncate(1);
|
||||
}
|
||||
|
||||
resolver.example(highlighted, &frames)
|
||||
let hash = typst::util::hash128(text);
|
||||
resolver.example(hash, highlighted, &frames)
|
||||
}
|
||||
|
||||
/// Extract an attribute value from an HTML element.
|
||||
|
@ -73,7 +73,7 @@ pub trait Resolver {
|
||||
fn image(&self, filename: &str, data: &[u8]) -> String;
|
||||
|
||||
/// Produce HTML for an example.
|
||||
fn example(&self, source: Html, frames: &[Frame]) -> Html;
|
||||
fn example(&self, hash: u128, source: Html, frames: &[Frame]) -> Html;
|
||||
|
||||
/// Determine the commits between two tags.
|
||||
fn commits(&self, from: &str, to: &str) -> Vec<Commit>;
|
||||
@ -988,7 +988,7 @@ mod tests {
|
||||
None
|
||||
}
|
||||
|
||||
fn example(&self, _: Html, _: &[Frame]) -> Html {
|
||||
fn example(&self, _: u128, _: Html, _: &[Frame]) -> Html {
|
||||
Html::new(String::new())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user