Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Fixes images within links (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
GyroJoe committed May 22, 2021
1 parent f1575c3 commit ed60da5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/CommonMark/Core/Node.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Node {
switch type {
case CMARK_NODE_DOCUMENT, CMARK_NODE_BLOCK_QUOTE, CMARK_NODE_LIST,
CMARK_NODE_ITEM, CMARK_NODE_PARAGRAPH, CMARK_NODE_HEADING,
CMARK_NODE_EMPH, CMARK_NODE_STRONG:
CMARK_NODE_EMPH, CMARK_NODE_STRONG, CMARK_NODE_LINK:
return Array(children.map(\.imageURLs).joined())
case CMARK_NODE_IMAGE:
return [url].compactMap { $0 }
Expand Down
2 changes: 2 additions & 0 deletions Tests/CommonMarkTests/DocumentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ final class DocumentTests: XCTestCase {
---
Emphasis *![](image5.jpg)* and strong **![](image6.jpg)**\
Repeated ![](image3.jpg)
[![](image7.jpg)](https://example.com)
"""

// when
Expand All @@ -466,6 +467,7 @@ final class DocumentTests: XCTestCase {
[
"image1.jpg", "image2.jpg", "image3.jpg",
"image4.jpg", "image5.jpg", "image6.jpg",
"image7.jpg",
],
result
)
Expand Down

0 comments on commit ed60da5

Please sign in to comment.