From 79fb8bad04662bfb5aa8990afeba4c134eb06201 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 26 Aug 2022 13:28:06 +0200 Subject: [feature] Allow footnotes in markdown, use `
` instead of `\n` (#767) * allow markdown footnotes + hard line breaks * don't keep whitespace w/minify (unnecessary now) * test markdown a bit more --- internal/text/markdown_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'internal/text/markdown_test.go') diff --git a/internal/text/markdown_test.go b/internal/text/markdown_test.go index af4a4fef6..3e156f43e 100644 --- a/internal/text/markdown_test.go +++ b/internal/text/markdown_test.go @@ -56,11 +56,15 @@ const ( mdWithHTML = "# Title\n\nHere's a simple text in markdown.\n\nHere's a link.\n\nHere's an image: \"The" mdWithHTMLExpected = "

Title

Here’s a simple text in markdown.

Here’s a link.

Here’s an image: \"The

" mdWithCheekyHTML = "# Title\n\nHere's a simple text in markdown.\n\nHere's a cheeky little script: " - mdWithCheekyHTMLExpected = "

Title

Here’s a simple text in markdown.

Here’s a cheeky little script:

" + mdWithCheekyHTMLExpected = "

Title

Here’s a simple text in markdown.

Here’s a cheeky little script:

" mdWithHashtagInitial = "#welcome #Hashtag" mdWithHashtagInitialExpected = "

#welcome #Hashtag

" mdCodeBlockWithNewlines = "some code coming up\n\n```\n\n\n\n```\nthat was some code" mdCodeBlockWithNewlinesExpected = "

some code coming up

\n\n\n

that was some code

" + mdWithFootnote = "fox mulder,fbi.[^1]\n\n[^1]: federated bureau of investigation" + mdWithFootnoteExpected = "

fox mulder,fbi.1


  1. federated bureau of investigation
" + mdWithBlockQuote = "get ready, there's a block quote coming:\n\n>line1\n>line2\n>\n>line3\n\n" + mdWithBlockQuoteExpected = "

get ready, there’s a block quote coming:

line1
line2

line3

" ) type MarkdownTestSuite struct { @@ -119,6 +123,16 @@ func (suite *MarkdownTestSuite) TestParseCodeBlockWithNewlines() { suite.Equal(mdCodeBlockWithNewlinesExpected, s) } +func (suite *MarkdownTestSuite) TestParseWithFootnote() { + s := suite.formatter.FromMarkdown(context.Background(), mdWithFootnote, nil, nil) + suite.Equal(mdWithFootnoteExpected, s) +} + +func (suite *MarkdownTestSuite) TestParseWithBlockquote() { + s := suite.formatter.FromMarkdown(context.Background(), mdWithBlockQuote, nil, nil) + suite.Equal(mdWithBlockQuoteExpected, s) +} + func TestMarkdownTestSuite(t *testing.T) { suite.Run(t, new(MarkdownTestSuite)) } -- cgit v1.2.3