diff --git a/Cargo.lock b/Cargo.lock index d6c02cbd..9a21dfb7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -260,9 +260,9 @@ dependencies = [ [[package]] name = "comrak" -version = "0.43.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ccfd7678fba9aff54a74a70352d952b345e568823ed9d5a92ebc8ad0adad8ea" +checksum = "07fcaf1ac457de7574ce514fd9a68e86e8196165529f48a544ec90cbea840e04" dependencies = [ "bon", "caseless", diff --git a/README.md b/README.md index 5a004059..7f8fbe88 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,7 @@ Commonmarker.to_html('"Hi *there*"', options: { | `superscript` | Enables the superscript Comrak extension. | `false` | | `header_ids` | Enables the header IDs Comrak extension. from the GFM spec. | `""` | | `footnotes` | Enables the footnotes extension per `cmark-gfm`. | `false` | +| `inline_footnotes` | Enables the inline footnotes extension. | `false` | | `description_lists` | Enables the description lists extension. | `false` | | `front_matter_delimiter` | Enables the front matter extension. | `""` | | `multiline_block_quotes` | Enables the multiline block quotes extension. | `false` | diff --git a/ext/commonmarker/Cargo.toml b/ext/commonmarker/Cargo.toml index e54d3ab3..cc721b6e 100644 --- a/ext/commonmarker/Cargo.toml +++ b/ext/commonmarker/Cargo.toml @@ -10,7 +10,7 @@ magnus = { version = "0.8", features = ["rb-sys"] } rb-sys = { version = "*", default-features = false, features = [ "stable-api-compiled-fallback", ] } -comrak = { version = "0.43", features = ["shortcodes"] } +comrak = { version = "0.44", features = ["shortcodes"] } syntect = { version = "5.3", features = ["plist-load"] } typed-arena = "2.0" rctree = "0.6" diff --git a/ext/commonmarker/src/options.rs b/ext/commonmarker/src/options.rs index 0c98d246..77fa40a4 100644 --- a/ext/commonmarker/src/options.rs +++ b/ext/commonmarker/src/options.rs @@ -109,6 +109,7 @@ const EXTENSION_TASKLIST: &str = "tasklist"; const EXTENSION_SUPERSCRIPT: &str = "superscript"; const EXTENSION_HEADER_IDS: &str = "header_ids"; const EXTENSION_FOOTNOTES: &str = "footnotes"; +const EXTENSION_INLINE_FOOTNOTES: &str = "inline_footnotes"; const EXTENSION_DESCRIPTION_LISTS: &str = "description_lists"; const EXTENSION_FRONT_MATTER_DELIMITER: &str = "front_matter_delimiter"; const EXTENSION_MULTILINE_BLOCK_QUOTES: &str = "multiline_block_quotes"; @@ -152,6 +153,9 @@ fn iterate_extension_options(comrak_options: &mut ComrakOptions, options_hash: R Cow::Borrowed(EXTENSION_FOOTNOTES) => { comrak_options.extension.footnotes = TryConvert::try_convert(value)?; } + Cow::Borrowed(EXTENSION_INLINE_FOOTNOTES) => { + comrak_options.extension.inline_footnotes = TryConvert::try_convert(value)?; + } Cow::Borrowed(EXTENSION_DESCRIPTION_LISTS) => { comrak_options.extension.description_lists = TryConvert::try_convert(value)?; } diff --git a/lib/commonmarker/config.rb b/lib/commonmarker/config.rb index f903e5c6..1cb60c5e 100644 --- a/lib/commonmarker/config.rb +++ b/lib/commonmarker/config.rb @@ -35,6 +35,7 @@ module Config superscript: false, header_ids: "", footnotes: false, + inline_footnotes: false, description_lists: false, front_matter_delimiter: "", multiline_block_quotes: false, diff --git a/test/footnotes_test.rb b/test/footnotes_test.rb index 4a0f3f28..bd034778 100644 --- a/test/footnotes_test.rb +++ b/test/footnotes_test.rb @@ -22,4 +22,22 @@ def test_to_html assert_equal(expected, Commonmarker.to_html(md, options: { extension: { footnotes: true } })) end + + def test_inline_to_html + md = <<~MARKDOWN + Let's render some footnotes^[This is a footnote] + MARKDOWN + expected = <<~HTML +
Let's render some footnotes1
+This is a footnote ↩
+