From a0a2ef020d1b03442c57abe8268227d95c224518 Mon Sep 17 00:00:00 2001 From: Ryan Booker <7423+ryanbooker@users.noreply.github.com> Date: Fri, 26 Apr 2024 20:58:15 +1000 Subject: [PATCH 1/2] Support b and i tags in Basic HTML --- Sources/SwiftHTMLtoMarkdown/BasicHTML.swift | 4 ++-- Tests/SwiftHTMLtoMarkdownTests/BasicHTMLTests.swift | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Sources/SwiftHTMLtoMarkdown/BasicHTML.swift b/Sources/SwiftHTMLtoMarkdown/BasicHTML.swift index fa97bd7..00ce01f 100644 --- a/Sources/SwiftHTMLtoMarkdown/BasicHTML.swift +++ b/Sources/SwiftHTMLtoMarkdown/BasicHTML.swift @@ -57,14 +57,14 @@ public class BasicHTML: HTML { let href = try node.attr("href") markdown += "(\(href))" return - } else if node.nodeName() == "strong" { + } else if node.nodeName() == "strong" || node.nodeName() == "b" { markdown += "**" for child in node.getChildNodes() { try convertNode(child) } markdown += "**" return - } else if node.nodeName() == "em" { + } else if node.nodeName() == "em" || node.nodeName() == "i" { markdown += "*" for child in node.getChildNodes() { try convertNode(child) diff --git a/Tests/SwiftHTMLtoMarkdownTests/BasicHTMLTests.swift b/Tests/SwiftHTMLtoMarkdownTests/BasicHTMLTests.swift index cfdfb3f..cf9a816 100644 --- a/Tests/SwiftHTMLtoMarkdownTests/BasicHTMLTests.swift +++ b/Tests/SwiftHTMLtoMarkdownTests/BasicHTMLTests.swift @@ -20,11 +20,12 @@ final class BasicHTMLTests: XCTestCase {
Heading level 6

I just love bold text.

-

Loveisbold

- +

Loveisbold

+

Italicized text is the cat's meow.

-

Acatsmeow

- + +

Acatsmeow

+

This text is really important.

This is some code Hello World!

From a3db8679150a78343c7db61b32962597f430240e Mon Sep 17 00:00:00 2001 From: Ryan Booker <7423+ryanbooker@users.noreply.github.com> Date: Fri, 26 Apr 2024 21:09:58 +1000 Subject: [PATCH 2/2] Bump support iOS version to fix compile errors on iOS --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index e7f9d82..bd7ae28 100644 --- a/Package.swift +++ b/Package.swift @@ -6,7 +6,7 @@ import PackageDescription let package = Package( name: "SwiftHTMLtoMarkdown", platforms: [ - .iOS(.v15), + .iOS(.v16), .macOS(.v13) ], products: [