[][src]Struct slack_blocks::compose::text::mrkdwn::Contents

pub struct Contents { /* fields omitted */ }

Markdown text

for more info, check out the slack api docs 🔗

Reserved Characters

Slack uses the following special characters, and recommends you HTML escape them like so:

➤ Click to expand
characterhow to escape
&&
<&lt;
>&gt;

Basic Formatting

NOTE: This is not an exhaustive list

This should, however, capture most basic use cases without requiring that you check with the Slack documentation.

For more info, please visit Slack's docs for markdown formatting 🔗

➤ Click to expand
slack markdownformatted result
_italic_italic
*bold*bold
~strike~strike
\nline break
> a block quote
a block quote
`some code!`some code!
```multiline code\n2 lines!```multiline code
2 lines!
- li \n - li
  • li
  • li
<http://www.foo.com|link name>link name
:joy: (list from iamcal/emoji-data 🔗)😂
link to #channel: <#Cxxxxxx>#channel
link to @user: <@Uxxxxxx>@user
link to @user_group: <!subteam^xxxxxx>@user_group

Implementations

impl Contents[src]

pub fn from_text(text: impl ToString) -> Self[src]

Construct some markdown text from a string or string-like value

Arguments

  • text - The text contents to render for this Text object. For some basic formatting examples, see the docs above for the Contents struct itself, or Slack's markdown docs 🔗. There are no intrinsic length limits on this, those are usually requirements of the context the text will be used in.

Example

use slack_blocks::compose::text::{mrkdwn, Text};

let text = mrkdwn::Contents::from_text("This link doesn't work! :tada: https://www.cheese.com")
    .with_verbatim(true);

pub fn with_verbatim(self, verbatim: bool) -> Self[src]

Sets the verbatim flag

Arguments

  • verbatim - When set to false (as is default) URLs will be auto-converted into links, conversation names will be link-ified, and certain mentions will be automatically parsed. Using a value of true will skip any preprocessing of this nature, although you can still include manual parsing strings.

Example

use slack_blocks::compose::text::{mrkdwn, Text};

let text = mrkdwn::Contents::from_text("This link doesn't work! :tada: https://www.cheese.com")
    .with_verbatim(true);

Trait Implementations

impl AsRef<str> for Contents[src]

impl Clone for Contents[src]

impl Debug for Contents[src]

impl Default for Contents[src]

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

impl<'_> From<&'_ str> for Contents[src]

impl From<Contents> for Compose[src]

impl From<Contents> for Text[src]

impl From<String> for Contents[src]

impl Hash for Contents[src]

impl PartialEq<Contents> for Contents[src]

impl Serialize for Contents[src]

impl StructuralPartialEq for Contents[src]

Auto Trait Implementations

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: for<'de> 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.