Skip to content

Commit

Permalink
Fix emphasized or strong text outside a link (Issue #15)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Mar 17, 2024
1 parent 04ee6b0 commit 23f964e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Changes in v2.0
markdown files.
- Added mmdutil "--no-title" option to disable the generated HTML title page.
- Updated `mmdGetWhitespace` and `mmdIsBlock` functions to return `bool` values.
- Fixed support for emphasized or strong text within a link (Issue #15)
- Fixed support for emphasized or strong linked text (Issue #15)
- Fixed an issue with headings directly after a table.
- Fixed lists in man page output.

Expand Down
7 changes: 6 additions & 1 deletion mmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1591,11 +1591,16 @@ mmd_parse_inline(_mmd_doc_t *doc, // I - Document
node = mmd_add(parent, MMD_TYPE_EMPHASIZED_TEXT, whitespace, text, url);
}
}
else
else if (type == MMD_TYPE_NORMAL_TEXT)
{
// Plain linked text...
node = mmd_add(parent, MMD_TYPE_LINKED_TEXT, whitespace, text, url);
}
else
{
// Preserve style of linked text...
node = mmd_add(parent, type, whitespace, text, url);
}

if (title)
node->extra = strdup(title);
Expand Down
8 changes: 6 additions & 2 deletions testmmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@ Normal link to [Heading 1](@).
Code link to [`Heading 2`](@).

Emphasized link to [*Heading 3*](@).
Inner emphasized link to [*Heading 3*](@).

Strong link to [**Heading 4**](@).
Outer emphasized link to *[Heading 3](@)*.

Inner strong link to [**Heading 4**](@).

Outer strong link to **[Heading 4](@)**.

Implicit link to [reference1][].

Expand Down

0 comments on commit 23f964e

Please sign in to comment.