diff --git a/src/html.rs b/src/html.rs index 7b83f3a8..1f5d9210 100644 --- a/src/html.rs +++ b/src/html.rs @@ -1155,13 +1155,14 @@ where NodeValue::Alert(ref alert) => { if entering { self.cr()?; - self.output.write_all(b"
\n")?; - self.output.write_all(b"

")?; + self.output + .write_all(b"

")?; match alert.title { Some(ref title) => self.escape(title.as_bytes())?, None => { diff --git a/src/parser/alert.rs b/src/parser/alert.rs index 32b82314..3c2068fa 100644 --- a/src/parser/alert.rs +++ b/src/parser/alert.rs @@ -52,11 +52,11 @@ impl AlertType { /// Returns the CSS class to use for an alert type pub(crate) fn css_class(&self) -> String { match *self { - AlertType::Note => String::from("alert-note"), - AlertType::Tip => String::from("alert-tip"), - AlertType::Important => String::from("alert-important"), - AlertType::Warning => String::from("alert-warning"), - AlertType::Caution => String::from("alert-caution"), + AlertType::Note => String::from("markdown-alert-note"), + AlertType::Tip => String::from("markdown-alert-tip"), + AlertType::Important => String::from("markdown-alert-important"), + AlertType::Warning => String::from("markdown-alert-warning"), + AlertType::Caution => String::from("markdown-alert-caution"), } } } diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 7d4e7cf1..07369bad 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -434,7 +434,7 @@ pub struct ExtensionOptions<'c> { /// let mut options = Options::default(); /// options.extension.alerts = true; /// assert_eq!(markdown_to_html("> [!note]\n> Something of note", &options), - /// "

\n

Note

\n

Something of note

\n
\n"); + /// "
\n

Note

\n

Something of note

\n
\n"); /// ``` #[cfg_attr(feature = "bon", builder(default))] pub alerts: bool, diff --git a/src/tests/alerts.rs b/src/tests/alerts.rs index 59985c8e..7f56f5ff 100644 --- a/src/tests/alerts.rs +++ b/src/tests/alerts.rs @@ -6,8 +6,8 @@ fn alerts() { [extension.alerts], concat!("> [!note]\n", "> Pay attention\n",), concat!( - "
\n", - "

Note

\n", + "
\n", + "

Note

\n", "

Pay attention

\n", "
\n", ), @@ -20,8 +20,8 @@ fn multiline_alerts() { [extension.alerts, extension.multiline_block_quotes], concat!(">>> [!note]\n", "Pay attention\n", ">>>",), concat!( - "
\n", - "

Note

\n", + "
\n", + "

Note

\n", "

Pay attention

\n", "
\n", ), diff --git a/src/tests/fixtures/alerts.md b/src/tests/fixtures/alerts.md index e02ed01a..149bb0a7 100644 --- a/src/tests/fixtures/alerts.md +++ b/src/tests/fixtures/alerts.md @@ -11,8 +11,8 @@ GitHub style alerts look like this: > [!NOTE] > Highlights information that users should take into account, even when skimming. . -
-

Note

+
+

Note

Highlights information that users should take into account, even when skimming.

```````````````````````````````` @@ -24,8 +24,8 @@ the `[!NOTE]`: > [!NOTE] > Highlights information that users should take into account, even when skimming. . -
-

Note

+
+

Note

Highlights information that users should take into account, even when skimming.

```````````````````````````````` @@ -36,8 +36,8 @@ Uppercase isn't required: > [!note] > Highlights information that users should take into account, even when skimming. . -
-

Note

+
+

Note

Highlights information that users should take into account, even when skimming.

```````````````````````````````` @@ -51,8 +51,8 @@ Alerts can contain multiple blocks: > > Paragraph two. . -
-

Note

+
+

Note

Highlights information that users should take into account, even when skimming.

Paragraph two.

@@ -64,8 +64,8 @@ Other kinds of alerts: > [!TIP] > Optional information to help a user be more successful. . -
-

Tip

+
+

Tip

Optional information to help a user be more successful.

```````````````````````````````` @@ -74,8 +74,8 @@ Other kinds of alerts: > [!IMPORTANT] > Crucial information necessary for users to succeed. . -
-

Important

+
+

Important

Crucial information necessary for users to succeed.

```````````````````````````````` @@ -84,8 +84,8 @@ Other kinds of alerts: > [!WARNING] > Critical content demanding immediate user attention due to potential risks. . -
-

Warning

+
+

Warning

Critical content demanding immediate user attention due to potential risks.

```````````````````````````````` @@ -94,8 +94,8 @@ Other kinds of alerts: > [!CAUTION] > Negative potential consequences of an action. . -
-

Caution

+
+

Caution

Negative potential consequences of an action.

```````````````````````````````` @@ -106,8 +106,8 @@ A title can be specified to override the default title: > [!NOTE] Pay attention > Highlights information that users should take into account, even when skimming. . -
-

Pay attention

+
+

Pay attention

Highlights information that users should take into account, even when skimming.

```````````````````````````````` @@ -118,8 +118,8 @@ The title does not process markdown and is escaped: > [!NOTE] **Pay** attention