Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

fix: enable markdown hard break (#644)

Guilherme Oenning5708cc18dd02
diff --git a/app/pkg/markdown/markdown_test.go b/app/pkg/markdown/markdown_test.go
index 7eb9d1548..6cf9fada7 100644
--- a/app/pkg/markdown/markdown_test.go
+++ b/app/pkg/markdown/markdown_test.go
@@ -15,6 +15,11 @@ func TestFullMarkdown(t *testing.T) {
"# Hello World": `<h1>Hello World</h1>`,
"![](http://example.com/hello.jpg)": `<p><img src="http://example.com/hello.jpg" alt="" /></p>`,
"Go to http://example.com/hello.jpg": `<p>Go to <a href="http://example.com/hello.jpg">http://example.com/hello.jpg</a></p>`,
+ `-123
+-456
+-789`: `<p>-123<br />
+-456<br />
+-789</p>`,
`
- **Option 1**
- *Option 2*
@@ -51,7 +56,12 @@ func TestPlainTextMarkdown(t *testing.T) {
"![My Image](http://example.com/hello.jpg)": ``,
"Go to http://example.com/hello.jpg": `Go to http://example.com/hello.jpg`,
"~~Option 3~~": `Option 3`,
- "# Hello World": `Hello World`,
+ `-123
+-456
+-789`: `-123
+-456
+-789`,
+ "# Hello World": `Hello World`,
`# Hello World
How are you?`: `Hello World
How are you?`,
@@ -79,6 +89,11 @@ func TestSimpleMarkdown(t *testing.T) {
"# Hello World": `<p>Hello World</p>`,
"### Hello World": `<p>Hello World</p>`,
"Check this out: `HEEEY`": "<p>Check this out: <code>HEEEY</code></p>",
+ `-123
+-456
+-789`: `<p>-123<br />
+-456<br />
+-789</p>`,
`# Hello World
How are you?`: `<p>Hello World</p>
diff --git a/public/services/markdown.spec.ts b/public/services/markdown.spec.ts
index 7f27aa01d..84c4e0551 100644
--- a/public/services/markdown.spec.ts
+++ b/public/services/markdown.spec.ts
@@ -32,6 +32,13 @@ How are you?`,
expectedFull: `<h1>Hello World</h1>
<p>How are you?</p>`,
expectedSimple: `<p>Hello World</p><p>How are you?</p>`
+ },
+ {
+ input: `-123
+-456
+-789`,
+ expectedFull: "<p>-123<br/>-456<br/>-789</p>",
+ expectedSimple: "<p>-123<br/>-456<br/>-789</p>"
}
];
diff --git a/public/services/markdown.ts b/public/services/markdown.ts
index 38f8dd909..9a43aaedf 100644
--- a/public/services/markdown.ts
+++ b/public/services/markdown.ts
@@ -4,7 +4,8 @@ marked.setOptions({
headerIds: false,
xhtml: true,
smartLists: true,
- gfm: true
+ gfm: true,
+ breaks: true
});
const link = (href: string, title: string, text: string) => {