Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
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) 
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:
- level 1
- level 1
- level 2
- 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 ¶
package main
import (
"fmt"
"github.com/lcomrade/md2html/v2"
)
func main() {
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)
}
Output:
func ConvertFile ¶
ConvertFile reads a file from the disk and converts it using 'Convert' function.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.