From 2e40be16e47141a79e5e26eed92329f5ef3a7bea Mon Sep 17 00:00:00 2001 From: Josh Rose <1677846+JoshTheWanderer@users.noreply.github.com> Date: Fri, 23 Jan 2026 15:34:16 +0100 Subject: [PATCH 1/2] fix: allow italic and bold at the start of a message --- app/helpers/content_filters/markdown_filter.rb | 2 +- test/helpers/content_filters_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 inline code with backticks" do assert_markdown_rendered "Use the `print()` function", /print\(\)<\/code>/ end From 57d29467d2815fcd2325d8bcb8d6af4f4306167f Mon Sep 17 00:00:00 2001 From: Josh Rose <1677846+JoshTheWanderer@users.noreply.github.com> Date: Fri, 23 Jan 2026 15:37:23 +0100 Subject: [PATCH 2/2] test: add test for multi-line italic rendering Co-Authored-By: Claude Opus 4.5 --- test/helpers/content_filters_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/helpers/content_filters_test.rb b/test/helpers/content_filters_test.rb index 8b0456bd..b9b5da6e 100644 --- a/test/helpers/content_filters_test.rb +++ b/test/helpers/content_filters_test.rb @@ -108,6 +108,14 @@ class ContentFiltersTest < ActionView::TestCase 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