diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5c8aaddb..65f50502 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -713,7 +713,7 @@ module ApplicationHelper item = strip_tags(content).strip anchor = item.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-') @parsed_headings << [level, anchor, item] - "#{content}" + "\n#{content}" end end diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 6d46aedf..5cb2c4cc 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -526,6 +526,13 @@ EXPECTED assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') end + def test_headings + raw = 'h1. Some heading' + expected = %|\n

Some heading

| + + assert_equal expected, textilizable(raw) + end + def test_table_of_content raw = <<-RAW {{toc}}