Implemented text formatting
This commit is contained in:
@ -29,6 +29,16 @@ func TestHeader(t *testing.T) {
|
||||
assert.Equal(t, markdown.Render("###### Header"), "<h6>Header</h6>")
|
||||
}
|
||||
|
||||
func TestItalic(t *testing.T) {
|
||||
assert.Equal(t, markdown.Render("*italic*"), "<p><em>italic</em></p>")
|
||||
assert.Equal(t, markdown.Render("_italic_"), "<p><em>italic</em></p>")
|
||||
}
|
||||
|
||||
func TestBold(t *testing.T) {
|
||||
assert.Equal(t, markdown.Render("**bold**"), "<p><strong>bold</strong></p>")
|
||||
assert.Equal(t, markdown.Render("__bold__"), "<p><strong>bold</strong></p>")
|
||||
}
|
||||
|
||||
func TestLink(t *testing.T) {
|
||||
assert.Equal(t, markdown.Render("[text](https://example.com/)"), "<p><a href=\"https://example.com/\">text</a></p>")
|
||||
assert.Equal(t, markdown.Render("[text](https://example.com/"), "<p>[text](https://example.com/</p>")
|
||||
@ -42,6 +52,7 @@ func TestList(t *testing.T) {
|
||||
assert.Equal(t, markdown.Render("- Entry"), "<ul><li>Entry</li></ul>")
|
||||
assert.Equal(t, markdown.Render("- Entry 1\n- Entry 2"), "<ul><li>Entry 1</li><li>Entry 2</li></ul>")
|
||||
assert.Equal(t, markdown.Render("- Entry 1\n- Entry 2\n- Entry 3"), "<ul><li>Entry 1</li><li>Entry 2</li><li>Entry 3</li></ul>")
|
||||
assert.Equal(t, markdown.Render("-"), "<p>-</p>")
|
||||
}
|
||||
|
||||
func TestTables(t *testing.T) {
|
||||
@ -77,6 +88,8 @@ func TestCombined(t *testing.T) {
|
||||
assert.Equal(t, markdown.Render("# Title\n\n- Entry 1\n- Entry 2\n\nText."), "<h1>Title</h1><ul><li>Entry 1</li><li>Entry 2</li></ul><p>Text.</p>")
|
||||
assert.Equal(t, markdown.Render("- Entry\n# Header"), "<ul><li>Entry</li></ul><h1>Header</h1>")
|
||||
assert.Equal(t, markdown.Render("> - Entry\n> # Header"), "<blockquote><ul><li>Entry</li></ul><h1>Header</h1></blockquote>")
|
||||
assert.Equal(t, markdown.Render("> **bold** and *italic* text."), "<blockquote><p><strong>bold</strong> and <em>italic</em> text.</p></blockquote>")
|
||||
assert.Equal(t, markdown.Render("> __bold__ and _italic_ text."), "<blockquote><p><strong>bold</strong> and <em>italic</em> text.</p></blockquote>")
|
||||
}
|
||||
|
||||
func TestSecurity(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user