stephenharris / WP-MarkDown

WP-MarkDown plug-in. Allows Markdown to be enabled in posts, comments and bbPress forums.
http://wordpress.org/extend/plugins/wp-markdown/
112 stars 19 forks source link

Truncated / Missing Link references when using <table> #33

Closed codemonkee closed 10 years ago

codemonkee commented 10 years ago

Created a post with 19 reference URLs not displayed in order of reference number. Updating the post, it is displayed as expected, opening the editor - the references have been reordered (which is expected as it's decoding from HTML).

A few of the links were originally displayed with - asdf. I went to display within a table

<div>
<table>
  <tr><th>Chrome</th><th>Firefox</th><th>Safari</th><th>Opera</th><tr>
  <tr>
    <td markdown="1">[Xdebug Helper][14]</td>
    <td markdown="1">
        [Easy Xdebug][15]
        [The easiest Xdebug][16]
    </td>
    <td markdown="1">[Xdebug Toggler][17]</td>
    <td markdown="1">
      [Xdebug Launcher][18] 
      [Xdebug][19]
    </td>
  </tr>
</table>
</div>

- Chrome:
 - [Xdebug Helper][14]
- Firefox:
 - [Easy Xdebug][15]
 - [The easiest Xdebug][16]
- Safari:
 - [Xdebug Toggler][17]
- Opera
 - [Xdebug Launcher][18] 
 - [Xdebug][19]

This results in the last two links within the table not being displayed and when opening the post back in the editor, the list of references only displays to 11 although the missing links are in the post but as HTML and not Markdown

stephenharris commented 10 years ago

Is the above what you entered? - having trouble following the steps to reproduce this :/

codemonkee commented 10 years ago

That is what I could reproduce it with, in terms of the table...

Close to original

Blah blah blah [Link 4][4] and [Link 5][5].

Maybe we'll try [Link 6][6]. and [Link 7][7] or [Link 8][8].

[Link 9][9]

#### Header 4 ####

Then some code!

    code, code, code

### Header 3! ###
My main IDEs are [Link 11][11] / [Link 10][10] with the occasional use of [Link 12][12].

### Browser Client Helpers ###

You may have noticed a [link 13][13] while in the PHPStorm.

2. Bookmarklets such as JetBrains' [Link 13 again!][13] creates. Simply Javascript bookmarks that create a cookie.
3. My favourite is [Link 14][14]

####Browser Extension / Plug-ins

<div>
<table>
  <tr><th>Chrome</th><th>Firefox</th><th>Safari</th><th>Opera</th><tr>
  <tr>
    <td markdown="1">[Link 14][14]</td>
    <td markdown="1">
        [Link 15][15]
        [Link 16][16]
    </td>
    <td markdown="1">[Link 17][17]</td>
    <td markdown="1">
      [Link 18][18] 
      [Link 19][19]
    </td>
  </tr>
</table>
</div>

- Chrome:
 - [Link 14][14]
- Firefox:
 - [Link 15][15]
 - [Link 16][16]
- Safari:
 - [Link 17][17]
- Opera
 - [Link 18][18] 
 - [Link 19][19]

## References ##

- [Link 1][1]
- [Link 2][2]
- [Link 3][3]

## Links ##
[Xdebug Extension for PHP][1]
[Feature: Remote Debugging][2]
[ActiveState Python Remote Debugging Client][3]
[Remote: Multiple User Debugging][4]
[Komodo Remote Debugging Package Downloads][5]
[ActiveState Code — Learn. Share. Get stuff done.][6]
[Get some Komodo Bits][7]
[Remote Debugging Bits][8]
[Windows (x86) Python Remote Debugging v8.5.1-82367][9]
[IntelliJ IDEA][10]
[PhpStorm][11]
[Aptana Studio][12]
[Zend Debugger & Xdebug bookmarklets generator][13]
[Chrome Extension: Xdebug Helper][14]
[Firefox Add-on: Easy Xdebug][15]
[Firefox Add-on: The easiest Xdebug][16]
[Safari Extension: Xdebug Toggler][17]
[Opera Add-on: Xdebug Launcher][18]
[Opera Add-on: Xdebug][19]

[1]: http://xdebug.org/ "Xdebug Extension for PHP"
[2]: http://xdebug.org/docs/remote/ "Feature: Remote Debugging"
[3]: http://code.activestate.com/komodo/remotedebugging/ "ActiveState Python Remote Debugging Client"
[4]: http://xdebug.org/docs/remote#multiple-users "Remote: Multiple User Debugging"
[5]: http://code.activestate.com/komodo/remotedebugging/ "Komodo Remote Debugging Package Downloads"
[6]: http://code.activestate.com "ActiveState Code — Learn. Share. Get stuff done."
[7]: http://code.activestate.com/komodo/ "Get some Komodo Bits"
[8]: http://code.activestate.com/komodo/remotedebugging/ "Remote Debugging Bits"
[9]: http://downloads.activestate.com/Komodo/releases/8.5.1/remotedebugging/Komodo-PythonRemoteDebugging-8.5.1-82367-win32-x86.zip "Windows (x86) Python Remote Debugging v8.5.1-82367"
[10]: http://www.jetbrains.com/idea/ "IntelliJ IDEA"
[11]: http://www.jetbrains.com/phpstorm/ "PhpStorm"
[12]: http://www.aptana.com/ "Aptana Studio"
[13]: http://www.jetbrains.com/phpstorm/marklets/ "Zend Debugger & Xdebug bookmarklets generator"
[14]: https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc "Chrome Extension: Xdebug Helper"
[15]: https://addons.mozilla.org/en-US/firefox/addon/easy-xdebug/ "Firefox Add-on: Easy Xdebug"
[16]: https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/ "Firefox Add-on: The easiest Xdebug"
[17]: https://github.com/benmatselby/xdebug-toggler/downloads "Safari Extension: Xdebug Toggler"
[18]: https://addons.opera.com/en/extensions/details/xdebug-launcher/ "Opera Add-on: Xdebug Launcher"
[19]: https://addons.opera.com/en/extensions/details/xdebug/ "Opera Add-on: Xdebug"

Output after edit

Blah blah blah [Link 4][1] and [Link 5][2].

Maybe we'll try [Link 6][3]. and [Link 7][4] or [Link 8][5].

[Link 9][6]

#### Header 4

Then some code!

    code, code, code

### Header 3!

My main IDEs are [Link 11][7] / [Link 10][8] with the occasional use of [Link 12][9].

### Browser Client Helpers

You may have noticed a [link 13][10] while in the PHPStorm.

1.  Bookmarklets such as JetBrains' [Link 13 again!][10] creates. Simply Javascript bookmarks that create a cookie.
2.  My favourite is [Link 14][11]

#### Browser Extension / Plug-ins

<div>
  <table>
    <tr>
      <th>
        Chrome
      </th>

      <th>
        Firefox
      </th>

      <th>
        Safari
      </th>

      <th>
        Opera
      </th>

      <tr>
        <tr>
          <td>
            <a href="https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc" title="Chrome Extension: Xdebug Helper">Link 14</a>
          </td>

          <td>
            <a href="https://addons.mozilla.org/en-US/firefox/addon/easy-xdebug/" title="Firefox Add-on: Easy Xdebug">Link 15</a> <a href="https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/" title="Firefox Add-on: The easiest Xdebug">Link 16</a>
          </td>

          <td>
            <a href="https://github.com/benmatselby/xdebug-toggler/downloads" title="Safari Extension: Xdebug Toggler">Link 17</a>
          </td>

          <td>
          </td>
        </tr></table> </div> 

        <ul>
          <li>
            Chrome: <ul>
              <li>
                <a href="https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc" title="Chrome Extension: Xdebug Helper">Link 14</a>
              </li>
            </ul>
          </li>

          <li>
            Firefox: <ul>
              <li>
                <a href="https://addons.mozilla.org/en-US/firefox/addon/easy-xdebug/" title="Firefox Add-on: Easy Xdebug">Link 15</a>
              </li>
              <li>
                <a href="https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/" title="Firefox Add-on: The easiest Xdebug">Link 16</a>
              </li>
            </ul>
          </li>

          <li>
            Safari: <ul>
              <li>
                <a href="https://github.com/benmatselby/xdebug-toggler/downloads" title="Safari Extension: Xdebug Toggler">Link 17</a>
              </li>
            </ul>
          </li>

          <li>
            Opera <ul>
              <li>
                <a href="https://addons.opera.com/en/extensions/details/xdebug-launcher/" title="Opera Add-on: Xdebug Launcher">Link 18</a>
              </li>
              <li>
                <a href="https://addons.opera.com/en/extensions/details/xdebug/" title="Opera Add-on: Xdebug">Link 19</a>
              </li>
            </ul>
          </li>
        </ul>

        <h2>
          References
        </h2>

        <ul>
          <li>
            <a href="http://xdebug.org/" title="Xdebug Extension for PHP">Link 1</a>
          </li>
          <li>
            <a href="http://xdebug.org/docs/remote/" title="Feature: Remote Debugging">Link 2</a>
          </li>
          <li>
            <a href="http://code.activestate.com/komodo/remotedebugging/" title="ActiveState Python Remote Debugging Client">Link 3</a>
          </li>
        </ul>

        <h2>
          Links
        </h2>

        <p>
          <a href="http://xdebug.org/" title="Xdebug Extension for PHP">Xdebug Extension for PHP</a> <a href="http://xdebug.org/docs/remote/" title="Feature: Remote Debugging">Feature: Remote Debugging</a> <a href="http://code.activestate.com/komodo/remotedebugging/" title="ActiveState Python Remote Debugging Client">ActiveState Python Remote Debugging Client</a> <a href="http://xdebug.org/docs/remote#multiple-users" title="Remote: Multiple User Debugging">Remote: Multiple User Debugging</a> <a href="http://code.activestate.com/komodo/remotedebugging/" title="Komodo Remote Debugging Package Downloads">Komodo Remote Debugging Package Downloads</a> <a href="http://code.activestate.com" title="ActiveState Code — Learn. Share. Get stuff done.">ActiveState Code — Learn. Share. Get stuff done.</a> <a href="http://code.activestate.com/komodo/" title="Get some Komodo Bits">Get some Komodo Bits</a> <a href="http://code.activestate.com/komodo/remotedebugging/" title="Remote Debugging Bits">Remote Debugging Bits</a> <a href="http://downloads.activestate.com/Komodo/releases/8.5.1/remotedebugging/Komodo-PythonRemoteDebugging-8.5.1-82367-win32-x86.zip" title="Windows (x86) Python Remote Debugging v8.5.1-82367">Windows (x86) Python Remote Debugging v8.5.1-82367</a> <a href="http://www.jetbrains.com/idea/" title="IntelliJ IDEA">IntelliJ IDEA</a> <a href="http://www.jetbrains.com/phpstorm/" title="PhpStorm">PhpStorm</a> <a href="http://www.aptana.com/" title="Aptana Studio">Aptana Studio</a> <a href="http://www.jetbrains.com/phpstorm/marklets/" title="Zend Debugger & Xdebug bookmarklets generator">Zend Debugger & Xdebug bookmarklets generator</a> <a href="https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc" title="Chrome Extension: Xdebug Helper">Chrome Extension: Xdebug Helper</a> <a href="https://addons.mozilla.org/en-US/firefox/addon/easy-xdebug/" title="Firefox Add-on: Easy Xdebug">Firefox Add-on: Easy Xdebug</a> <a href="https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/" title="Firefox Add-on: The easiest Xdebug">Firefox Add-on: The easiest Xdebug</a> <a href="https://github.com/benmatselby/xdebug-toggler/downloads" title="Safari Extension: Xdebug Toggler">Safari Extension: Xdebug Toggler</a> <a href="https://addons.opera.com/en/extensions/details/xdebug-launcher/" title="Opera Add-on: Xdebug Launcher">Opera Add-on: Xdebug Launcher</a> <a href="https://addons.opera.com/en/extensions/details/xdebug/" title="Opera Add-on: Xdebug">Opera Add-on: Xdebug</a>
        </p>

 [1]: http://xdebug.org/docs/remote#multiple-users "Remote: Multiple User Debugging"
 [2]: http://code.activestate.com/komodo/remotedebugging/ "Komodo Remote Debugging Package Downloads"
 [3]: http://code.activestate.com "ActiveState Code — Learn. Share. Get stuff done."
 [4]: http://code.activestate.com/komodo/ "Get some Komodo Bits"
 [5]: http://code.activestate.com/komodo/remotedebugging/ "Remote Debugging Bits"
 [6]: http://downloads.activestate.com/Komodo/releases/8.5.1/remotedebugging/Komodo-PythonRemoteDebugging-8.5.1-82367-win32-x86.zip "Windows (x86) Python Remote Debugging v8.5.1-82367"
 [7]: http://www.jetbrains.com/phpstorm/ "PhpStorm"
 [8]: http://www.jetbrains.com/idea/ "IntelliJ IDEA"
 [9]: http://www.aptana.com/ "Aptana Studio"
 [10]: http://www.jetbrains.com/phpstorm/marklets/ "Zend Debugger & Xdebug bookmarklets generator"
 [11]: https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc "Chrome Extension: Xdebug Helper"
stephenharris commented 10 years ago

The first row of your table isn't closed properly:

<tr><th>Chrome</th><th>Firefox</th><th>Safari</th><th>Opera</th><tr>

note the <tr> rather than </tr> at the end. On my test site, fixing that resolves the issue.

Evidently after the first save, browsers deal with the broken HTML, so it appears fine on the front. But the broken HTML confuses the HTML -> MarkDown converter which then generates faulty markdown as a result...

codemonkee commented 10 years ago

Can't believe I missed that, Thanks for catching it.