#[non_exhaustive]pub enum MarkupLanguage {
Markdown,
ReStructuredText,
Html,
PlainText,
RendererDisabled,
Unkown,
None,
}
Expand description
The Markup language of the note content.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Markdown
ReStructuredText
Html
PlainText
RendererDisabled
The markup language is known, but the renderer is disabled.
Unkown
This is a Tp-Note file, but we are not able to determine the MarkupLanguage at this point.
None
This is not a Tp-Note file.
Implementations§
Source§impl MarkupLanguage
impl MarkupLanguage
Sourcepub fn mine_type(&self) -> Option<&'static str>
pub fn mine_type(&self) -> Option<&'static str>
Returns the MIME type for all Markup Languages.is_tpnote_file()==true
.
Otherwise, for MarkupLanguage::None
this returns None.
Sourcepub fn is_some(&self) -> bool
pub fn is_some(&self) -> bool
As we identify a markup language by the file’s extension, we
can also tell, in case Markuplanguage::from(ext).is_some()
,
that a file with the extension ext
is a Tp-Note file.
Sourcepub fn is_none(&self) -> bool
pub fn is_none(&self) -> bool
As we identify a markup language by the file’s extension, we
can also tell, in case Markuplanguage::from(ext).is_none()
,
that a file with the extension ext
is NOT a Tp-Note file.
Sourcepub fn render(&self, input: &str) -> String
pub fn render(&self, input: &str) -> String
Every MarkupLanguage
variant has an own internal HTML renderer:
Markdown
is rendered according the “CommonMark” standard.- Currently only as small subset of ReStructuredText is rendered for
ReStructuredText
. This feature is experimental. - The
Html
renderer simply forwards the input without modification. PlainText
is rendered as raw text. Hyperlinks in Markdown, ReStructuredText, AsciiDoc and WikiText syntax are detected and are displayed in the rendition with their link text. All hyperlinks are clickable.Unknown
is rendered likePlainText
, hyperlinks are also clickable, but they are displayed as they appear in the input.- For the variant
None
the result is always the empty string whatever the input may be.
Trait Implementations§
Source§impl Clone for MarkupLanguage
impl Clone for MarkupLanguage
Source§fn clone(&self) -> MarkupLanguage
fn clone(&self) -> MarkupLanguage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for MarkupLanguage
impl Debug for MarkupLanguage
Source§impl Default for MarkupLanguage
impl Default for MarkupLanguage
Source§fn default() -> MarkupLanguage
fn default() -> MarkupLanguage
Source§impl<'de> Deserialize<'de> for MarkupLanguage
impl<'de> Deserialize<'de> for MarkupLanguage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<&Path> for MarkupLanguage
impl From<&Path> for MarkupLanguage
Source§impl From<&str> for MarkupLanguage
impl From<&str> for MarkupLanguage
Source§impl Hash for MarkupLanguage
impl Hash for MarkupLanguage
Source§impl PartialEq for MarkupLanguage
impl PartialEq for MarkupLanguage
Source§impl Serialize for MarkupLanguage
impl Serialize for MarkupLanguage
impl Copy for MarkupLanguage
impl Eq for MarkupLanguage
impl StructuralPartialEq for MarkupLanguage
Auto Trait Implementations§
impl Freeze for MarkupLanguage
impl RefUnwindSafe for MarkupLanguage
impl Send for MarkupLanguage
impl Sync for MarkupLanguage
impl Unpin for MarkupLanguage
impl UnwindSafe for MarkupLanguage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more