alminium / redmine_redcarpet_formatter

Another Markdown Wiki Formatter for Redmine based on Redcarpet markdown processor.
GNU General Public License v2.0
135 stars 38 forks source link

Right-side TOC "macro" doesn't work when using markdown syntax #12

Open joerocklin opened 12 years ago

joerocklin commented 12 years ago

The right-side toc format "macro" (put in quotes because it's not really a macro, but uses the macro markup) uses the format {{>toc}}. The markdown html highlighter seems to take the bare > at the beginning and turn it into >. The regexp that redmine is using to look for the TOC alignment is:

TOC_RE = /<p>\{\{([<>]?)toc\}\}<\/p>/i 

(found in redmine/app/helpers/application_helper.rb on line 881 as of version 2.0.3)

Unfortunately, just changing the TOC_RE definition won't solve the problem as the replace_toc method which uses the regex looks for the > character explicitly. Perhaps a replacement replace_toc method should be supplied with this plugin to handle this case?

yangacer commented 11 years ago

I'm confronting the same problem. Is there any progress on this?

joerocklin commented 11 years ago

Oops - hit the wrong button there! I had modified the redmine regexp to make things work on my local installation. If I get some time I'll look into it in the coming weeks to see if there's any way to patch it from the plugin.

marmotz commented 11 years ago

any news for this issue ?

onlyjob commented 11 years ago

Indeed it would be very nice to have this issue fixed...

joerocklin commented 11 years ago

I haven't had a chance to turn my changes into something that can work from the plugin. I do have the setup working with modified redmine code, but I don't think that's an acceptable solution.

onlyjob commented 11 years ago

I'm happy to report that I figured out how to spell right-side TOC with markdown:

><p>{{>toc}}</p>

Thanks @joerocklin, your clue regarding TOC_RE was most helpful.