Struct mdbook::config::HtmlConfig

source ·
pub struct HtmlConfig {
Show 22 fields pub theme: Option<PathBuf>, pub default_theme: Option<String>, pub preferred_dark_theme: Option<String>, pub curly_quotes: bool, pub mathjax_support: bool, pub copy_fonts: bool, pub google_analytics: Option<String>, pub additional_css: Vec<PathBuf>, pub additional_js: Vec<PathBuf>, pub fold: Fold, pub playground: Playground, pub code: Code, pub print: Print, pub no_section_label: bool, pub search: Option<Search>, pub git_repository_url: Option<String>, pub git_repository_icon: Option<String>, pub input_404: Option<String>, pub site_url: Option<String>, pub cname: Option<String>, pub edit_url_template: Option<String>, pub redirect: HashMap<String, String>, /* private fields */
}
Expand description

Configuration for the HTML renderer.

Fields§

§theme: Option<PathBuf>

The theme directory, if specified.

§default_theme: Option<String>

The default theme to use, defaults to ‘light’

§preferred_dark_theme: Option<String>

The theme to use if the browser requests the dark version of the site. Defaults to ‘navy’.

§curly_quotes: bool

Use “smart quotes” instead of the usual " character.

§mathjax_support: bool

Should mathjax be enabled?

§copy_fonts: bool

Whether to fonts.css and respective font files to the output directory.

§google_analytics: Option<String>

An optional google analytics code.

§additional_css: Vec<PathBuf>

Additional CSS stylesheets to include in the rendered page’s <head>.

§additional_js: Vec<PathBuf>

Additional JS scripts to include at the bottom of the rendered page’s <body>.

§fold: Fold

Fold settings.

§playground: Playground

Playground settings.

§code: Code

Code settings.

§print: Print

Print settings.

§no_section_label: bool

Don’t render section labels.

§search: Option<Search>

Search settings. If None, the default will be used.

§git_repository_url: Option<String>

Git repository url. If None, the git button will not be shown.

§git_repository_icon: Option<String>

FontAwesome icon class to use for the Git repository link. Defaults to fa-github if None.

§input_404: Option<String>

Input path for the 404 file, defaults to 404.md, set to “” to disable 404 file output

§site_url: Option<String>

Absolute url to site, used to emit correct paths for the 404 page, which might be accessed in a deeply nested directory

§cname: Option<String>

The DNS subdomain or apex domain at which your book will be hosted. This string will be written to a file named CNAME in the root of your site, as required by GitHub Pages (see Managing a custom domain for your GitHub Pages site).

§edit_url_template: Option<String>

Edit url template, when set shows a “Suggest an edit” button for directly jumping to editing the currently viewed page. Contains {path} that is replaced with chapter source file path

§redirect: HashMap<String, String>

The mapping from old pages to new pages/URLs to use when generating redirects.

Implementations§

source§

impl HtmlConfig

source

pub fn theme_dir(&self, root: &Path) -> PathBuf

Returns the directory of theme from the provided root directory. If the directory is not present it will append the default directory of “theme”

Trait Implementations§

source§

impl Clone for HtmlConfig

source§

fn clone(&self) -> HtmlConfig

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for HtmlConfig

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for HtmlConfig

source§

fn default() -> HtmlConfig

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for HtmlConfig

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for HtmlConfig

source§

fn eq(&self, other: &HtmlConfig) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for HtmlConfig

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for HtmlConfig

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,