Repository: zestedesavoir/zmarkdown (js)

Issue:
autolink with two underscore give italic font
with this markdown : 

```
https://developer.mozilla.org/fr/Apps/Game_engines_and_libraries
```
we get
```html
<p><a href="https://developer.mozilla.org/fr/Apps/Game_engines_and_libraries">https://developer.mozilla.org/fr/Apps/Game<em>engines</em>and_libraries</a></p>
```

but we expect : 
```html
<p><a href="https://developer.mozilla.org/fr/Apps/Game_engines_and_libraries">https://developer.mozilla.org/fr/Apps/Game_engines_and_libraries</a></p>
```



Pull request description:
Disable pedantic parsing -- close #245
#245 https://github.com/remarkjs/remark/tree/master/packages/remark-parse#optionspedantic :

> Pedantic mode (`boolean`, default: `false`) turns on:
> 
> *   Emphasis (`_alpha_`) and importance (`__bravo__`) with underscores
>     in words
> *   Unordered lists with different markers (`*`, `-`, `+`)
> *   ~~If `commonmark` is also turned on, ordered lists with different
>     markers (`.`, `)`)~~
> *   And pedantic mode removes less spaces in list-items (at most four,
>     instead of the whole indent)

@artragis @arobase-che Please read the diff and make sure this is what we want. Pay special attention to how lists will require exact indentation with pedantic disabled.

Patch:
diff --git a/packages/zmarkdown/config/remark.js b/packages/zmarkdown/config/remark.js
index 2c625e83..da567fdd 100644
--- a/packages/zmarkdown/config/remark.js
+++ b/packages/zmarkdown/config/remark.js
@@ -23,7 +23,7 @@ const remarkConfig = {
     gfm: true,
     commonmark: false,
     footnotes: true,
-    pedantic: true,
+    pedantic: false,
     /* sets list of known blocks to nothing, otherwise <h3>hey</h3> would become
     &#x3C;h3>hey&#x3C;/h3> instead of <p>&#x3C;h3>hey&#x3C;/h3></p> */
     blocks: [],


Test patch:
diff --git a/packages/zmarkdown/__tests__/__snapshots__/new-html-suite.test.js.snap b/packages/zmarkdown/__tests__/__snapshots__/new-html-suite.test.js.snap
index 47531230..face73a9 100644
--- a/packages/zmarkdown/__tests__/__snapshots__/new-html-suite.test.js.snap
+++ b/packages/zmarkdown/__tests__/__snapshots__/new-html-suite.test.js.snap
@@ -9,8 +9,20 @@ exports[`images become figures: does not apply when a caption is present 1`] = `
 
 exports[`images become figures: works with only an image 1`] = `"<figure><img src=\\"http://blabla.fr\\" alt=\\"wrapped into _figure_\\"><figcaption>wrapped into _figure_</figcaption></figure>"`;
 
-exports[`smileys translates >_< 1`] = `"<p>This is funny <img src=\\"/static/smileys/pinch.png\\" alt=\\">_<\\" class=\\"smiley\\"></p>"`
+exports[`pedantic mode disabled unordered lists markers 1`] = `
+"<ul>
+<li>a</li>
+</ul>
+<ul>
+<li>b</li>
+</ul>
+<ul>
+<li>c</li>
+</ul>"
+`;
+
+exports[`smileys translates >_< 1`] = `"<p>This is funny <img src=\\"/static/smileys/pinch.png\\" alt=\\">_<\\" class=\\"smiley\\"></p>"`;
 
-exports[`smileys translates X/ 1`] = `"<p>This is funny <img src=\\"/static/smileys/pinch.png\\" alt=\\"X/\\" class=\\"smiley\\"></p>"`
+exports[`smileys translates X/ 1`] = `"<p>This is funny <img src=\\"/static/smileys/pinch.png\\" alt=\\"X/\\" class=\\"smiley\\"></p>"`;
 
-exports[`smileys translates cthulhu 1`] = `"<p><img src=\\"/static/smileys/cthulhu.png\\" alt=\\"^(;,;)^\\" class=\\"smiley\\"></p>"`
+exports[`smileys translates cthulhu 1`] = `"<p><img src=\\"/static/smileys/cthulhu.png\\" alt=\\"^(;,;)^\\" class=\\"smiley\\"></p>"`;
diff --git a/packages/zmarkdown/__tests__/__snapshots__/old-suite-latex.test.js.snap b/packages/zmarkdown/__tests__/__snapshots__/old-suite-latex.test.js.snap
index e0394ab5..41d87f9f 100644
--- a/packages/zmarkdown/__tests__/__snapshots__/old-suite-latex.test.js.snap
+++ b/packages/zmarkdown/__tests__/__snapshots__/old-suite-latex.test.js.snap
@@ -289,14 +289,14 @@ exports[`#basic properly renders codeblock-in-list.txt 1`] = `
 \\\\item A list item with a code block
 
 \\\\begin{CodeBlock}{text}
-Some *code*
+  Some *code*
 \\\\end{CodeBlock}
 \\\\item Another list item
 
 \\\\begin{CodeBlock}{text}
-More code
+  More code
 
-And more code
+  And more code
 \\\\end{CodeBlock}
 \\\\end{itemize}"
 `;
@@ -2892,8 +2892,8 @@ asda asdf asdfasd
 exports[`#misc properly renders lists3.txt 1`] = `
 "\\\\begin{itemize}
 \\\\item blah blah blah
-sdf asdf asdf asdf asdf
-asda asdf asdfasd
+  sdf asdf asdf asdf asdf
+  asda asdf asdfasd
 \\\\end{itemize}"
 `;
 
@@ -3111,7 +3111,7 @@ exports[`#misc properly renders smart_em.txt 1`] = `
 
 
 
-this\\\\textit{is}not\\\\_emphasis
+this\\\\_is\\\\_not\\\\_emphasis
 
 
 
@@ -3119,11 +3119,11 @@ this\\\\textit{is}not\\\\_emphasis
 
 
 
-\\\\textit{punctuation}with\\\\textit{emphasis}\\\\ref{_punctuation_with_emphasis_}
+\\\\textit{punctuation\\\\_with\\\\_emphasis}\\\\ref{_punctuation_with_emphasis_}
 
 
 
-punctuation\\\\textit{without}emphasis\\\\ref{punctuation_without_emphasis}"
+punctuation\\\\_without\\\\_emphasis\\\\ref{punctuation_without_emphasis}"
 `;
 
 exports[`#misc properly renders span.txt 1`] = `
@@ -3142,10 +3142,10 @@ exports[`#misc properly renders span.txt 1`] = `
 <baza id=\\"someId\\"> Foo \\\\textit{bar} Baz </baza>"
 `;
 
-exports[`#misc properly renders strong-with-underscores.txt 1`] = `"\\\\textbf{this\\\\textit{is}strong}"`;
+exports[`#misc properly renders strong-with-underscores.txt 1`] = `"\\\\textbf{this\\\\_is\\\\_strong}"`;
 
 exports[`#misc properly renders underscores.txt 1`] = `
-"THIS\\\\textit{SHOULD}STAY\\\\textit{AS}IS
+"THIS\\\\_SHOULD\\\\_STAY\\\\_AS\\\\_IS
 
 
 
diff --git a/packages/zmarkdown/__tests__/fixtures/basic/codeblock-in-list.html b/packages/zmarkdown/__tests__/fixtures/basic/codeblock-in-list.html
index 49edd562..f1b129e7 100644
--- a/packages/zmarkdown/__tests__/fixtures/basic/codeblock-in-list.html
+++ b/packages/zmarkdown/__tests__/fixtures/basic/codeblock-in-list.html
@@ -8,7 +8,7 @@
 <p>Another list item</p>
 <pre><code>More code
 
-And more code
+  And more code
 </code></pre>
 </li>
-</ul>
\ No newline at end of file
+</ul>
diff --git a/packages/zmarkdown/__tests__/fixtures/misc/funky-list.html b/packages/zmarkdown/__tests__/fixtures/misc/funky-list.html
deleted file mode 100644
index 313db8fc..00000000
--- a/packages/zmarkdown/__tests__/fixtures/misc/funky-list.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<ol>
-<li>this starts a list <em>with</em> numbers</li>
-<li>this will show as number "2"</li>
-<li>this will show as number "3."</li>
-<li>any number, +, -, or * will keep the list going.</li>
-</ol>
-<p>aaaaaaaaaaaaaaa</p>
-<ul>
-<li>now a normal list</li>
-<li>and more</li>
-</ul>
\ No newline at end of file
diff --git a/packages/zmarkdown/__tests__/fixtures/misc/funky-list.txt b/packages/zmarkdown/__tests__/fixtures/misc/funky-list.txt
deleted file mode 100644
index 48ecd608..00000000
--- a/packages/zmarkdown/__tests__/fixtures/misc/funky-list.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-1. this starts a list *with* numbers
-+  this will show as number "2"
-*  this will show as number "3."
-9. any number, +, -, or * will keep the list going.
-
-aaaaaaaaaaaaaaa
-
-- now a normal list
-- and more
diff --git a/packages/zmarkdown/__tests__/fixtures/misc/lists6.html b/packages/zmarkdown/__tests__/fixtures/misc/lists6.html
index 24aad388..8fc88f10 100644
--- a/packages/zmarkdown/__tests__/fixtures/misc/lists6.html
+++ b/packages/zmarkdown/__tests__/fixtures/misc/lists6.html
@@ -1,11 +1,17 @@
 <p>Test five or more spaces as start of list:</p>
 <ul>
-<li>five spaces</li>
+<li>
+<pre><code>five spaces
+</code></pre>
+</li>
 </ul>
 <p>not first item:</p>
 <ul>
 <li>one space</li>
-<li>five spaces</li>
+<li>
+<pre><code>five spaces
+</code></pre>
+</li>
 </ul>
 <p>loose list:</p>
 <ul>
@@ -13,6 +19,7 @@
 <p>one space</p>
 </li>
 <li>
-<p>five spaces</p>
+<pre><code>five spaces
+</code></pre>
 </li>
-</ul>
\ No newline at end of file
+</ul>
diff --git a/packages/zmarkdown/__tests__/fixtures/misc/nested-lists.html b/packages/zmarkdown/__tests__/fixtures/misc/nested-lists.html
index 6114e82b..1c731aad 100644
--- a/packages/zmarkdown/__tests__/fixtures/misc/nested-lists.html
+++ b/packages/zmarkdown/__tests__/fixtures/misc/nested-lists.html
@@ -58,9 +58,9 @@
 </li>
 <li>
 <p>item 4-3</p>
-<p>Paragraph under item 4-3</p>
+<pre><code>Code under item 4-3</code></pre>
+<p>Paragraph under item 4</p>
 </li>
 </ul>
-<p>Paragraph under item 4</p>
 </li>
 </ul>
diff --git a/packages/zmarkdown/__tests__/fixtures/misc/nested-lists.txt b/packages/zmarkdown/__tests__/fixtures/misc/nested-lists.txt
index a2704b43..f458e72b 100644
--- a/packages/zmarkdown/__tests__/fixtures/misc/nested-lists.txt
+++ b/packages/zmarkdown/__tests__/fixtures/misc/nested-lists.txt
@@ -28,6 +28,6 @@ plain text
     * item 4-2
     * item 4-3
 
-        Paragraph under item 4-3
+        Code under item 4-3
 
     Paragraph under item 4
diff --git a/packages/zmarkdown/__tests__/fixtures/misc/smart_em.html b/packages/zmarkdown/__tests__/fixtures/misc/smart_em.html
index 5ededddb..998442fb 100644
--- a/packages/zmarkdown/__tests__/fixtures/misc/smart_em.html
+++ b/packages/zmarkdown/__tests__/fixtures/misc/smart_em.html
@@ -1,5 +1,5 @@
 <p><em>emphasis</em></p>
-<p>this<em>is</em>not_emphasis</p>
+<p>this_is_not_emphasis</p>
 <p>[<em>punctuation with emphasis</em>]</p>
-<p>[<em>punctuation</em>with<em>emphasis</em>]</p>
-<p>[punctuation<em>without</em>emphasis]</p>
+<p>[<em>punctuation_with_emphasis</em>]</p>
+<p>[punctuation_without_emphasis]</p>
diff --git a/packages/zmarkdown/__tests__/fixtures/misc/strong-with-underscores.html b/packages/zmarkdown/__tests__/fixtures/misc/strong-with-underscores.html
index ef023403..f110fff4 100644
--- a/packages/zmarkdown/__tests__/fixtures/misc/strong-with-underscores.html
+++ b/packages/zmarkdown/__tests__/fixtures/misc/strong-with-underscores.html
@@ -1,1 +1,1 @@
-<p><strong>this<em>is</em>strong</strong></p>
+<p><strong>this_is_strong</strong></p>
diff --git a/packages/zmarkdown/__tests__/fixtures/misc/stronintags.html b/packages/zmarkdown/__tests__/fixtures/misc/strongintags.html
similarity index 100%
rename from packages/zmarkdown/__tests__/fixtures/misc/stronintags.html
rename to packages/zmarkdown/__tests__/fixtures/misc/strongintags.html
diff --git a/packages/zmarkdown/__tests__/fixtures/misc/stronintags.txt b/packages/zmarkdown/__tests__/fixtures/misc/strongintags.txt
similarity index 100%
rename from packages/zmarkdown/__tests__/fixtures/misc/stronintags.txt
rename to packages/zmarkdown/__tests__/fixtures/misc/strongintags.txt
diff --git a/packages/zmarkdown/__tests__/fixtures/misc/underscores.html b/packages/zmarkdown/__tests__/fixtures/misc/underscores.html
index aa1d48e3..f9aac7b9 100644
--- a/packages/zmarkdown/__tests__/fixtures/misc/underscores.html
+++ b/packages/zmarkdown/__tests__/fixtures/misc/underscores.html
@@ -1,4 +1,4 @@
-<p>THIS<em>SHOULD</em>STAY<em>AS</em>IS</p>
+<p>THIS_SHOULD_STAY_AS_IS</p>
 <p>Here is some <em>emphasis</em>, ok?</p>
 <p>Ok, at least <em>this</em> should work.</p>
 <p>THIS<strong>SHOULD</strong>STAY</p>
diff --git a/packages/zmarkdown/__tests__/new-html-suite.test.js b/packages/zmarkdown/__tests__/new-html-suite.test.js
index e8bf2f68..19956503 100644
--- a/packages/zmarkdown/__tests__/new-html-suite.test.js
+++ b/packages/zmarkdown/__tests__/new-html-suite.test.js
@@ -240,3 +240,42 @@ describe('smileys', () => {
     return expect(renderString(input)).resolves.toMatchSnapshot()
   })
 })
+
+describe('pedantic mode disabled', () => {
+  it(`unordered lists markers`, () => {
+    const input = dedent`
+      * a
+      - b
+      * c
+    `
+
+    return expect(renderString(input)).resolves.toMatchSnapshot()
+  })
+
+  it(`leading spaces in list item`, async () => {
+    const three = dedent`
+      *    a
+    `
+    expect(await renderString(three)).not.toContain('<pre>')
+
+    const four = dedent`
+      *     a
+    `
+    expect(await renderString(four)).toContain('<pre>')
+
+    const five = dedent`
+      *      a
+    `
+    expect(await renderString(five)).toContain('<pre>')
+  })
+
+  it(`em`, () => {
+    const input = dedent`
+      no_em_here
+
+      http://localhost/foo_bar_baz
+    `
+
+    return expect(renderString(input)).resolves.not.toContain('<em>')
+  })
+})
diff --git a/packages/zmarkdown/__tests__/old-html-suite.test.js b/packages/zmarkdown/__tests__/old-html-suite.test.js
index ff581bc5..25cd1def 100644
--- a/packages/zmarkdown/__tests__/old-html-suite.test.js
+++ b/packages/zmarkdown/__tests__/old-html-suite.test.js
@@ -378,11 +378,6 @@ describe('#misc', () => {
     return expect(renderFile()(filepath)).resolves.toHTML(loadFixture(filepath).trim())
   })
 
-  it(`properly renders funky-list.txt`, function () {
-    const filepath = `${dir}/funky-list.txt`
-    return expect(renderFile()(filepath)).resolves.toHTML(loadFixture(filepath).trim())
-  })
-
   it(`properly renders h1.txt`, () => {
     const filepath = `${dir}/h1.txt`
     return expect(renderFile()(filepath)).resolves.toHTML(loadFixture(filepath).trim())
@@ -598,8 +593,8 @@ describe('#misc', () => {
     return expect(renderFile()(filepath)).resolves.toHTML(loadFixture(filepath).trim())
   })
 
-  it.skip(`properly renders stronintags.txt`, function () {
-    const filepath = `${dir}/stronintags.txt`
+  it.skip(`properly renders strongintags.txt`, function () {
+    const filepath = `${dir}/strongintags.txt`
     return expect(renderFile()(filepath)).resolves.toHTML(loadFixture(filepath).trim())
   })
 
diff --git a/packages/zmarkdown/__tests__/old-suite-latex.test.js b/packages/zmarkdown/__tests__/old-suite-latex.test.js
index c13ba222..e0adf379 100644
--- a/packages/zmarkdown/__tests__/old-suite-latex.test.js
+++ b/packages/zmarkdown/__tests__/old-suite-latex.test.js
@@ -336,11 +336,6 @@ describe('#misc', () => {
     return expect(renderFile()(filepath)).resolves.toMatchSnapshot()
   })
 
-  it.skip(`properly renders funky-list.txt`, function () {
-    const filepath = `${dir}/funky-list.txt`
-    return expect(renderFile()(filepath)).resolves.toMatchSnapshot()
-  })
-
   it(`properly renders h1.txt`, () => {
     const filepath = `${dir}/h1.txt`
     return expect(renderFile()(filepath)).resolves.toMatchSnapshot()
@@ -556,8 +551,8 @@ describe('#misc', () => {
     return expect(renderFile()(filepath)).resolves.toMatchSnapshot()
   })
 
-  it.skip(`properly renders stronintags.txt`, function () {
-    const filepath = `${dir}/stronintags.txt`
+  it.skip(`properly renders strongintags.txt`, function () {
+    const filepath = `${dir}/strongintags.txt`
     return expect(renderFile()(filepath)).resolves.toMatchSnapshot()
   })