amyreese / markdown-pp

Preprocessor for Markdown files to generate a table of contents and other documentation needs
MIT License
309 stars 68 forks source link

Support for headings with links in them #5

Closed joshjordan closed 12 years ago

joshjordan commented 12 years ago

markdown-pp used to produce something like this when it encountered headings with links:

3.3\.  [[macvim](http://code.google.com/p/macvim/)](#[macvim]http://code.google.com/p/macvim/)  
<a name="[macvim]http://code.google.com/p/macvim/"></a>
## [macvim](http://code.google.com/p/macvim/)

Now, you'll see this:

3.3\.  [macvim](#macvim)  
<a name="macvim"></a>
## [macvim](http://code.google.com/p/macvim/)
amyreese commented 12 years ago

This is an excellent feature, but it's missing a use case. Some Markdown links can use the [title][linkname] syntax format, and this patch does not account for that. Looking at the source code, it seems like it should just require a change to the linkre regex to support square brackets instead of the parentheses, but I'm not sure.

If you could update this to support both link formats, I will gladly merge it. Thanks!

joshjordan commented 12 years ago

Hi John,

Thanks for the consideration. I updated to use both Markdown formats, and found a bug with my previous implementation along the way (which is now fixed for both link styles).

Josh

On Wed, Sep 5, 2012 at 12:11 PM, John Reese notifications@github.comwrote:

This is an excellent feature, but it's missing a use case. Some Markdown links can use the [title][linkname] syntax format, and this patch does not account for that. Looking at the source code, it seems like it should just require a change to the linkre regex to support square brackets instead of the parentheses, but I'm not sure.

If you could update this to support both link formats, I will gladly merge it. Thanks!

— Reply to this email directly or view it on GitHubhttps://github.com/jreese/markdown-pp/pull/5#issuecomment-8304281.

amyreese commented 12 years ago

Thanks for the contributions! :)