Yamd

Struct Yamd 

Source
pub struct Yamd {
    pub metadata: Option<String>,
    pub body: Vec<YamdNodes>,
}
Expand description

§Yamd

Metadata is optional Frontmatter.

Can be only in the beginning of the document surrounded by Minus of length 3 followed by EOL and EOL followed by Minus of length 3. Can contain any string that is parsable by the consumer.

For example toml:

---
title: "Yamd"
tags:
- software
- rust
---

Body can contain one or more:

Separated by Terminator.

Example:

Yamd can contain a Paragraph. Or a

# Heading

Or one image:

![alt](src)

Or code:

```rust
let a="or a code block";
```

Or unordered list:

- Level 0
 - Level 1

Or ordered list:

+ Level 0
+ Level 0
 + Level 1

It also can have a thematic break:

-----

Or embed:

{{youtube|url}}

Or multiple images combined into gallery. There is no 1:1 match for that in HTML, and multiple
ways to do it depending on how it will be rendered:

![alt](src)
![alt](src)

Or a highlight:

>> Highlight title
> warning
There is no 1:1 equivalent to a highlight in HTML.

Highlight body can contain multiple paragraphs.
>>

{% Or collapsible
Which is also does not have 1:1 equivalent in HTML
%}

HTML equivalent:

<p>Yamd can contain a Paragraph. Or a</p>
<h1>Heading</h1>
<p>Or one image:</p>
<img src="url" alt="alt"/>
<p>Or code:</p>
<pre><code>let a="or a code block";</code></pre>
<p>Or unordered list:</p>
<ul>
    <li>
        Level 0
        <ul>
            <li>Level 1</li>
        </ul>
    </li>
</ul>
<p>Or ordered list:</p>
<ol>
    <li>Level 0</li>
    <li>
        Level 1
        <ol>
            <li>Level 1</li>
        </ol>
    </li>
</ol>
<p>It also can have a thematic break:</p>
<hr/>
<p>Or embed:</p>
<iframe class="youtube" src="url" />
<p>Or multiple images combined into gallery, there is no 1:1 match for that in HTML, and multiple
ways to do it depending on how it will be rendered:</p>
<div class="images">
    <img src="url" alt="alt"/>
    <img src="url" alt="alt"/>
</div>
<p>Or a highlight:</p>
<div class="highlight">
    <div class="icon warning"></div>
    <div class="body">
        <h3>Highlight title</h3>
        <p>There is no 1:1 equivalent to a highlight in HTML.</p>
        <p>Highlight body can contain multiple paragraphs.</p>
    </div>
</div>
<div class="collapsible">
    <input type="checkbox" id="{{ node.title }}" />
    <label for="{{ node.title }}">Or collapsible</label>
    <div class="body">
        <p>Which is also does not have 1:1 equivalent in HTML</p>
    </div>
</div>

Fields§

§metadata: Option<String>§body: Vec<YamdNodes>

Implementations§

Source§

impl Yamd

Source

pub fn new(metadata: Option<String>, body: Vec<YamdNodes>) -> Self

Trait Implementations§

Source§

impl Clone for Yamd

Source§

fn clone(&self) -> Yamd

Returns a duplicate 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 Yamd

Source§

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

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

impl Default for Yamd

Source§

fn default() -> Yamd

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

impl Display for Yamd

Source§

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

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

impl PartialEq for Yamd

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Yamd

Source§

impl StructuralPartialEq for Yamd

Auto Trait Implementations§

§

impl Freeze for Yamd

§

impl RefUnwindSafe for Yamd

§

impl Send for Yamd

§

impl Sync for Yamd

§

impl Unpin for Yamd

§

impl UnwindSafe for Yamd

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.