md2html

package module
v2.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(text string) string

Convert Markdown to HTML.

Headers:

# This is a H1 header
## This is a H2 header
### This is a H3 header
#### This is a H4 header
##### This is a H5 header
###### This is a H6 header
## Closed H2 title #
## Closed H2 title ##
## Closed H2 title ######

Text style ('*' may be replaced by '_'):

*Italic text*
**Bold text**
***Bold and italic text***
~~Strikethrough text~~

Link and image:

[Example link](https://example.org)
![Alt text](https://example.org/image.png)

Autolink:

admin@example.org
http://example.org
https://example.org
ftp://ftp.mozilla.org
irc://irc.debian.org/debian

Code:

`Code quote`

```
go doc
go tool dist list
go help build
```

````markdown
```
go doc
go tool dist list
go help build
```
````

Unordered list ('-' may be replaced by '+' or '*'):

  • level 1
  • level 1
  • level 2
  • level 2 ^^^^ (4 spaces)

Numbered list:

  1. level 1
  2. level 1
  3. level 2
  4. level 2 ^^^^ (4 spaces)

Character shielding:

| Input | Output |
|-------|--------|
| \*    | *      |
| \_    | _      |
| \~    | ~      |
| \#    | #      |
| \+    | +      |
| \-    | -      |
| \.    | .      |

Paragraphs: A blank line is used to separate paragraphs.

Embedded HTML: If the HTML is not in a code block, it will not be escaped. That mean, you can use HTML tags inside a Markdown document.

Example
result := md2html.Convert(`
# Header H1
## Header H2
### Header H3
#### Header H4
##### Header H5
###### Header H6

- *Italic* and _Italic_
- **Bold** and __Bold__
- ~~Strikethrough~~

[Example link](https://example.org)

1. level 1
2. level 1
    1. level 2
    2. level 2
`)

fmt.Println(result)

func ConvertFile

func ConvertFile(path string) (string, error)

ConvertFile reads a file from the disk and converts it using 'Convert' function.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL