[][src]Struct mdpage::Content

pub struct Content {
    pub is_heading: Option<bool>,
    pub is_break: Option<bool>,
    pub label: Option<String>,
    pub url: Option<String>,
    pub markdown: Option<String>,
    pub html: Option<String>,
    pub file: Option<PathBuf>,
    pub dir: Option<PathBuf>,
}

Content struct represents content of the document as well as the menu items.

Fields

is_heading: Option<bool>

A boolean flag to specify that the object is a heading in the menu. In this case it must have "label" specified to be displayed in the menu.

is_break: Option<bool>

A boolean flag to specify a line break in the menu.

label: Option<String>

The string to be used as label for the content in the menu.

url: Option<String>

The URL for an external link. If specified the menu will be a link to this URL.

markdown: Option<String>

The optional raw markdown to be converted into HTML for the content. Usually this would be read from a file.

html: Option<String>

The raw markdown to be converted into HTML for the content. This is normally generated by converting the markdown contents.

file: Option<PathBuf>

The path to the markdown or HTML file used for the content. We read this into markdown property and convert it to HTML content to be displayed. If label is not specified, we also infer the title for the content from the heading in markdown content.

dir: Option<PathBuf>

As an alternative to file we can specify the directory path used to build contents. The content will be sourced from all the files and immediate subdirectories in the path.

Methods

impl Content[src]

pub fn new(file: Option<PathBuf>) -> Content[src]

pub fn new_heading(label: String) -> Content[src]

pub fn new_break() -> Content[src]

pub fn init_from_file(&mut self, root: &Path)[src]

Initializes the label from the file property if present.

Trait Implementations

impl Clone for Content[src]

impl Debug for Content[src]

impl Default for Content[src]

impl<'de> Deserialize<'de> for Content[src]

impl PartialEq<Content> for Content[src]

impl Serialize for Content[src]

Auto Trait Implementations

impl RefUnwindSafe for Content

impl Send for Content

impl Sync for Content

impl Unpin for Content

impl UnwindSafe for Content

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.