diff --git a/app/helpers/content_filters/markdown_filter.rb b/app/helpers/content_filters/markdown_filter.rb index 5aad59fc..09709e7a 100644 --- a/app/helpers/content_filters/markdown_filter.rb +++ b/app/helpers/content_filters/markdown_filter.rb @@ -12,7 +12,7 @@ class ContentFilters::MarkdownFilter < ActionText::Content::Filter # 2. Use backslash escaping: \*\*not bold\*\* → renders as **not bold** (plain text) MARKDOWN_PATTERNS = [ /\*\*[^*]+\*\*/, # Bold: **text** - /(?italic<\/em>/ end + test "renders italic text at line start" do + assert_markdown_applicable "*italic* at start" + assert_markdown_rendered "*italic* at start", /italic<\/em>/ + end + + test "renders italic text spanning multiple lines" do + multiline_italic = "*italic text\nacross lines*" + assert_markdown_applicable multiline_italic + filtered = apply_text_filters(multiline_italic) + assert_match /italic text/, filtered.to_html + assert_match /across lines<\/em>/, filtered.to_html + end + test "renders inline code with backticks" do assert_markdown_rendered "Use the `print()` function", /print\(\)<\/code>/ end