An open API service indexing awesome lists of open source software.

https://github.com/divadretlaw/html2markdown


https://github.com/divadretlaw/html2markdown

Last synced: 6 months ago
JSON representation

Awesome Lists containing this project

README

        

# HTML2Markdown

## What is this?

It's a Swift Package which attempts to convert HTML into Markdown.

## How do I use it?

```swift
let html = "

This is a terrible idea.
I must be daft.

"

do {
let dom = try HTMLParser().parse(html: html)
let markdown = dom.markdownFormatted(options: .unorderedListBullets)
print(markdown)
} catch {
// parsing error
}
```

This generates the following markdown string:

```
This is a *terrible* idea.\nI must be daft.
```

## What is supported?

* `` and `` for highlighting text
* ordered and unordered lists (`

    ` and `