require "test_helper" class MarkdownHelperTest < ActionView::TestCase test "renders GitHub-flavored Markdown and keeps single line breaks" do html = markdown("**Hangar** code 1234\nGate on the left\n\n- [x] Oil\n- [ ] Tires\n\n| A | B |\n|---|---|\n| 1 | 2 |") assert_includes html, "Hangar code 1234
" assert_includes html, '' assert_includes html, "1" assert_match(/\A
/, html) end test "drops raw HTML and script links; links open in a new tab" do html = markdown("\n\nSee [bad](javascript:alert(1)) https://example.com") refute_match(/' end test "excerpts are plain text" do assert_equal "Oil leak at the sump Check it", markdown_excerpt("# Oil leak\nat the *sump*\n\n- Check it") assert_equal "", markdown_excerpt(nil) end end