SwiftHTMLToMarkdown icon indicating copy to clipboard operation
SwiftHTMLToMarkdown copied to clipboard

Fix headline bug and add image support

Open Astrian opened this issue 1 year ago • 2 comments

  • Add image tags support
  • Add DIV tags support (will be tricked as general paragraph)
  • Fix a problem with the lack of \n\n before the headline so that the headline may be rendered to the last paragraph

BTW. The Xcode 16.0 reports an error indicating that the firstMatch(in: _) function may not be available in lower than iOS 16 (Sources/SwiftHTMLtoMarkdown/BasicHTML.swift:98). I have no idea if it is a critical issue because I have no errors encountered when I use this library with network reference. The error appears when I clone the library to the local and import it as a local library.

Here is a suggested fix authored by Xcode:

image

Astrian avatar Sep 07 '24 00:09 Astrian

Thank you for making this PR! What are the changes to the Headers? I am seeing tests for those failing so I am wondering if the tests are incorrect because output was originally flawed.

ActuallyTaylor avatar Sep 09 '24 14:09 ActuallyTaylor

Thank you for making this PR! What are the changes to the Headers? I am seeing tests for those failing so I am wondering if the tests are incorrect because output was originally flawed.

The headline will be rendered as a part of its last block (paragraph), not a single block, like this (all ##s should be h2 marks):

image

I doubt if it is an issue leading with the iOS SDK version. It may also cause the firstMatch (in: _) error I mentioned before, which will appear when I import the library directly from the cloned one instead of the GitHub repository. It may be evidence that there is no issue on your side with the last version of the code, for I am using Xcode beta version (16.0)

Astrian avatar Sep 10 '24 12:09 Astrian