diff --git a/README.md b/README.md index dbd29a85..28942313 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,7 @@ Commonmarker.to_html('"Hi *there*"', options: { | `description_lists` | Enables the description lists extension. | `false` | | `front_matter_delimiter` | Enables the front matter extension. | `""` | | `shortcodes` | Enables the shortcodes extension. | `true` | +| `multiline_block_quotes` | Enables the multiline block quotes extension. | `false` | For more information on these options, see [the comrak documentation](https://github.com/kivikakk/comrak#usage). diff --git a/ext/commonmarker/src/options.rs b/ext/commonmarker/src/options.rs index 974252b0..09044328 100644 --- a/ext/commonmarker/src/options.rs +++ b/ext/commonmarker/src/options.rs @@ -75,6 +75,7 @@ const EXTENSION_FOOTNOTES: &str = "footnotes"; const EXTENSION_DESCRIPTION_LISTS: &str = "description_lists"; const EXTENSION_FRONT_MATTER_DELIMITER: &str = "front_matter_delimiter"; const EXTENSION_SHORTCODES: &str = "shortcodes"; +const EXTENSION_MULTILINE_BLOCK_QUOTES: &str = "multiline_block_quotes"; fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: RHash) { options_hash @@ -117,6 +118,10 @@ fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: R Ok(Cow::Borrowed(EXTENSION_SHORTCODES)) => { comrak_options.extension.shortcodes = TryConvert::try_convert(value)?; } + Ok(Cow::Borrowed(EXTENSION_MULTILINE_BLOCK_QUOTES)) => { + comrak_options.extension.multiline_block_quotes = + TryConvert::try_convert(value)?; + } _ => {} } Ok(ForEach::Continue) diff --git a/lib/commonmarker/config.rb b/lib/commonmarker/config.rb index 10de2096..ad38bdf6 100644 --- a/lib/commonmarker/config.rb +++ b/lib/commonmarker/config.rb @@ -29,6 +29,7 @@ module Config description_lists: false, front_matter_delimiter: "", shortcodes: true, + multiline_block_quotes: false, }, format: [:html].freeze, }.freeze diff --git a/test/multiline_block_quotes_test.rb b/test/multiline_block_quotes_test.rb new file mode 100644 index 00000000..19640fad --- /dev/null +++ b/test/multiline_block_quotes_test.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require "test_helper" + +class MultilineBlockQuotesTest < Minitest::Test + def test_to_html + md = <<~MARKDOWN + >>> + Paragraph 1 + + Paragraph 2 + >>> + MARKDOWN + expected = <<~HTML +
+

Paragraph 1

+

Paragraph 2

+
+ HTML + + assert_equal(expected, Commonmarker.to_html(md, options: { extension: { multiline_block_quotes: true } })) + end +end