Skip to content

Commit 099f6f2

Browse files
readme: improve documentation for plugins
1 parent 0f887f8 commit 099f6f2

File tree

12 files changed

+125
-29
lines changed

12 files changed

+125
-29
lines changed
227 KB
Loading
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

README.md

Lines changed: 61 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,47 @@
22

33
A robust html-to-markdown converter that transforms HTML (even entire websites) into clean, readable Markdown. It supports complex formatting, customizable options, and plugins for full control over the conversion process.
44

5-
Use the fully extendable [Golang library](#golang-library) or a quick [CLI command](#cli---using-it-on-the-command-line). Try the [demo](https://html-to-markdown.com/demo) to see it in action!
5+
Use the fully extendable [Golang library](#golang-library) or a quick [CLI command](#cli---using-it-on-the-command-line). Alternatively, try the [Online Demo](https://html-to-markdown.com/demo) or [REST API](https://html-to-markdown.com/api) to see it in action!
66

77
Here are some _cool features_:
88

99
- **Bold & Italic:** Supports bold and italic—even within single words.
1010

11-
![](./.github/point_bold_italic.png)
11+
![](./.github/images/point_bold_italic.png)
1212

1313
- **List:** Handles ordered and unordered lists with full nesting support.
1414

15-
![](./.github/point_list.png)
15+
![](./.github/images/point_list.png)
1616

1717
- **Blockquote:** Blockquotes can include other elements, with seamless support for nested quotes.
1818

19-
![](./.github/point_blockquote.png)
19+
![](./.github/images/point_blockquote.png)
2020

2121
- **Inline Code & Code Block:** Correctly handles backticks and multi-line code blocks, preserving code structure.
2222

23-
![](./.github/point_code.png)
23+
![](./.github/images/point_code.png)
2424

2525
- **Link & Image:** Properly formats multi-line links, adding escapes for blank lines where needed.
2626

27-
![](./.github/point_link_image.png)
27+
![](./.github/images/point_link_image.png)
2828

2929
- **Smart Escaping:** Escapes special characters only when necessary, to avoid accidental Markdown rendering.
3030
🗒️ [ESCAPING.md](/ESCAPING.md)
3131

32-
![](./.github/point_escaping.png)
32+
![](./.github/images/point_escaping.png)
3333

3434
- **Remove/Keep HTML:** Choose to strip or retain specific HTML tags for ultimate control over output.
3535

36-
![](./.github/point_wrapper.png)
36+
![](./.github/images/point_wrapper.png)
3737

3838
- **Plugins:** Easily extend with plugins. Or create custom ones to enhance functionality.
3939

40-
![](./.github/point_strikethrough.png)
40+
![](./.github/images/point_strikethrough.png)
4141

4242
---
4343

4444
---
4545

46-
> [!WARNING]
47-
> This is an **early experimental version** of the library.
48-
>
49-
> We encourage testing and bug reporting. However, please note:
50-
>
51-
> - Not production-ready
52-
> - Default options are well-tested, but custom configurations have limited coverage
53-
> - Functionality is currently restricted
54-
> - Focus is on stabilization and core features
55-
> - No compatibility guarantee
56-
> - Only use `htmltomarkdown.ConvertString()` and `htmltomarkdown.ConvertNode()` from the root package. They are _unlikely_ to change.
57-
> - Other functions and nested packages are _very like_ to change.
58-
59-
---
60-
6146
## Golang Library
6247

6348
### Installation
@@ -68,6 +53,9 @@ go get -u github.com/JohannesKaufmann/html-to-markdown/v2
6853

6954
_Or if you want a specific commit add the suffix `/v2@commithash`_
7055

56+
> [!NOTE]
57+
> This is the documentation for the v2 library. For the old version switch to the ["v1" branch](https://github.com/JohannesKaufmann/html-to-markdown/tree/v1).
58+
7159
### Usage
7260

7361
[![Go V2 Reference](https://pkg.go.dev/badge/github.com/JohannesKaufmann/html-to-markdown/v2.svg)](https://pkg.go.dev/github.com/JohannesKaufmann/html-to-markdown/v2)
@@ -96,7 +84,7 @@ func main() {
9684

9785
- 🧑‍💻 [Example code, basics](/examples/basics/main.go)
9886

99-
The function `htmltomarkdown.ConvertString()` is just a small wrapper around `converter.NewConverter()` and `commonmark.NewCommonmarkPlugin()`. If you want more control, use the following:
87+
The function `htmltomarkdown.ConvertString()` is a _small wrapper_ around `converter.NewConverter()` and the _base_ and _commonmark_ plugins. If you want more control, use the following:
10088

10189
```go
10290
package main
@@ -139,7 +127,48 @@ func main() {
139127
140128
### Plugins
141129

142-
TODO: info about plugins
130+
#### Published Plugins
131+
132+
These are the plugins located in the [plugin folder](/plugin):
133+
134+
| Name | Description |
135+
| --------------------- | ------------------------------------------------------------------------------------ |
136+
| Base | Implements basic shared functionality (e.g. removing nodes) |
137+
| Commonmark | Implements Markdown according to the [Commonmark Spec](https://spec.commonmark.org/) |
138+
| | |
139+
| GitHubFlavored | _planned_ |
140+
| TaskListItems | _planned_ |
141+
| Strikethrough | Converts `<strike>`, `<s>`, and `<del>` to the `~~` syntax. |
142+
| Table | _planned_ |
143+
| | |
144+
| VimeoEmbed | _planned_ |
145+
| YoutubeEmbed | _planned_ |
146+
| | |
147+
| ConfluenceCodeBlock | _planned_ |
148+
| ConfluenceAttachments | _planned_ |
149+
150+
> [!NOTE]
151+
> Not all the plugins from v1 are already ported to v2. These will soon be implemented...
152+
153+
These are the plugins in other repositories:
154+
155+
| Name | Description |
156+
| ---------------------------- | ------------------- |
157+
| \[Plugin Name\]\(Your Link\) | A short description |
158+
159+
#### Writing Plugins
160+
161+
You want to write custom logic?
162+
163+
1. Write your logic and **register** it.
164+
165+
![](./.github/images/autocomplete_register.png)
166+
167+
- 🧑‍💻 [Example code, register](/examples/register/main.go)
168+
169+
2. _Optional:_ Package your logic into a **plugin** and publish it.
170+
171+
- 🗒️ [WRITING_PLUGINS.md](/WRITING_PLUGINS.md)
143172

144173
---
145174

@@ -199,10 +228,14 @@ _(The cli does not support every option yet. Over time more customization will b
199228
### Extending with Plugins
200229

201230
- Need your own logic? Write your own code and then **register** it.
202-
- Don't like the **defaults** that the library uses? You can use `PriorityEarly` to run you logic _earlier_ than others.
231+
232+
- Don't like the **defaults** that the library uses? You can use `PriorityEarly` to run you logic _earlier_ than others.
233+
234+
- 🧑‍💻 [Example code, register](/examples/register/main.go)
235+
203236
- If you believe that you logic could also benefit others, you can package it up into a **plugin**.
204237

205-
🗒️ [WRITING_PLUGINS.md](/WRITING_PLUGINS.md)
238+
- 🗒️ [WRITING_PLUGINS.md](/WRITING_PLUGINS.md)
206239

207240
### Bugs
208241

0 commit comments

Comments
 (0)