Skip to content

Commit

Permalink
Expand more link types to inline links
Browse files Browse the repository at this point in the history
This is needed in order to retain old behavior after the upgrade
of pulldown-cmark-to-cmark.
  • Loading branch information
kdarkhan committed Nov 1, 2024
1 parent 2d0fad0 commit b7d538b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions i18n-helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,27 @@ pub fn new_cmark_parser<'input, F: BrokenLinkCallback<'input>>(
/// );
/// ```
pub fn extract_events<'a>(text: &'a str, state: Option<State<'a>>) -> Vec<(usize, Event<'a>)> {
// Expand a `[foo]` style link into `[foo][foo]`.
// Expand a `[foo]` style links into inline links like `[foo](url)`
fn expand_shortcut_link(tag: Tag<'_>) -> Tag<'_> {
match tag {
Tag::Link {
link_type: LinkType::Shortcut,
link_type: LinkType::Shortcut | LinkType::Collapsed | LinkType::Reference,
dest_url,
title,
id,
} => Tag::Link {
link_type: LinkType::Reference,
link_type: LinkType::Inline,
dest_url,
title,
id,
},
Tag::Image {
link_type: LinkType::Shortcut,
link_type: LinkType::Shortcut | LinkType::Collapsed | LinkType::Reference,
dest_url,
title,
id,
} => Tag::Image {
link_type: LinkType::Reference,
link_type: LinkType::Inline,
dest_url,
title,
id,
Expand Down

0 comments on commit b7d538b

Please sign in to comment.