Skip to content

Commit

Permalink
Remove inline <!-- more -->
Browse files Browse the repository at this point in the history
  • Loading branch information
clarfonthey committed Aug 12, 2024
1 parent 948c536 commit 7fba0e1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
4 changes: 1 addition & 3 deletions components/markdown/src/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,7 @@ pub fn markdown_to_html(
event
});
}
Event::Html(text) | Event::InlineHtml(text)
if !has_summary && MORE_DIVIDER_RE.is_match(text.as_ref()) =>
{
Event::Html(text) if !has_summary && MORE_DIVIDER_RE.is_match(text.as_ref()) => {
has_summary = true;
events.push(Event::Html(CONTINUE_READING.into()));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
source: components/markdown/tests/summary.rs
expression: rendered.body
---
<p>Things to do:</p>
<ul>
<li>Program <!-- more --> something</li>
<li>Eat</li>
<li>Sleep</li>
</ul>

This file was deleted.

13 changes: 9 additions & 4 deletions components/markdown/tests/summary.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
mod common;

fn get_summary(content: &str) -> String {
common::render(content).expect("couldn't render").summary.expect("had no summary")
get_rendered(content).summary.expect("had no summary")
}

fn get_rendered(content: &str) -> markdown::Rendered {
common::render(content).expect("couldn't render")
}

#[test]
Expand Down Expand Up @@ -44,16 +48,17 @@ And some content after
}

#[test]
fn truncated_summary() {
let body = get_summary(
fn no_truncated_summary() {
let rendered = get_rendered(
r#"
Things to do:
* Program <!-- more --> something
* Eat
* Sleep
"#,
);
insta::assert_snapshot!(body);
assert!(rendered.summary.is_none());
insta::assert_snapshot!(rendered.body);
}

#[test]
Expand Down

0 comments on commit 7fba0e1

Please sign in to comment.