Feature #15520

Markdown formatting

Added by Jean-Claude Wippler about 3 years ago. Updated 3 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Text formatting
Target version:2.5.0
Resolution:Fixed

Description

The (well... my) world is moving towards Markdown for formatting text: GitHub, WordPress, LeanPub all support it natively.

I have used a Markdown plugin with Redmine years ago (in the 1.x series), with limited success, perhaps partly due to the plugin not tracking Redmine releases. Now I'm on 2.3.x, about to move to 2.4.x. The contributors to our open source wiki's, forums, and issue trackers all use Textile and the conversion to get there was a bit painful at the time.

I'd like to ask, nay beg on my knees, to consider adding Markdown as first-class citizen to Redmine. It would mean a substantial amount of content conversion for me, but in the long run I nevertheless consider this a no-brainer: Markdown has become the de-facto standard across a wide range of use-cases, and some sites add extra features to make it fit their specific needs even better. Markdown-with-diverging-extensions would be still vastly preferable to me over the Textile-Markdown mix I currently have to take care of. Every message, post, issue, and reply requires extra attention to stick to the proper formatting rules (evidently) - it adds up, and it keeps on adding up.

Nirvana would be to reached by even allowing admins to change the formatting of an existing project area, perhaps using pandoc for the process. I suspect that there might be a fair amount of pent-up demand for this, but it's obviously a lot more work and only relevant once the essential first step has been implemented.

I'll gladly make another donation to Redmine if this helps put this feature request on the roadmap, but yeah... I know it's a big wish and no doubt everyone on the Redmine time is already more than busy.

But please do (re-) consider this seriously. There's nothing wrong with occasionally re-evaluating past choices.

-jcw


Related issues

Related to Redmine - Feature #20497: Markdown formatting supporting HTML New
Duplicated by Redmine - Feature #14260: Simplify the syntax highlighting Closed

Associated revisions

Revision 12452
Added by Jean-Philippe Lang about 3 years ago

Adds experimental support for Markdown formatting with redcarpet (#15520).

Revision 12461
Added by Toshi MARUYAMA about 3 years ago

fix typo redcarpet requirement in lib/redmine.rb (#15520)

Revision 14244
Added by Jean-Philippe Lang over 1 year ago

Removed experimental flag on markdown format (#15520).

History

#1 Updated by Jan Niggemann (redmine.org team member) about 3 years ago

  • Tracker changed from Defect to Feature

Of course, this is no defect, but a feature request...

#2 Updated by Stefan Tatschner about 3 years ago

+100

#3 Updated by ixbidie ixbidie about 3 years ago

there is a plugin implementing exactly this.

https://github.com/alminium/redmine_redcarpet_formatter

#4 Updated by Jean-Philippe Lang about 3 years ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version set to 2.5.0
  • Resolution set to Fixed

Markdown formatting support is added in r12452 using the redcarpet gem. It should be considered as experimental for now but already supports syntax highlight integration, single section edit for wiki pages, inline images from attachments and Redmine links. There's no plan to provide automatic convertion of existing text from textile to markdown.

#5 Updated by Jean-Claude Wippler about 3 years ago

Confirmed on 2.4.2.devel.12480. Works great - fantastic, thank you!

(yeah, automatic conversion would require something like Pandoc - a per-project setting might be useful as first work-around to support gradual manual migration, but then you need another setting for non-project related stuff, such as site descriptions)

#6 Updated by mc0e . over 1 year ago

Where this is considered experimental, are there known shortcomings, or is it just that issues may not yet have surfaced?

Does this status need review now, being a year down the track? Are there known issues that should perhaps be linked here?

#7 Updated by Jean-Philippe Lang over 1 year ago

mc0e . wrote:

Where this is considered experimental, are there known shortcomings, or is it just that issues may not yet have surfaced?

Does this status need review now, being a year down the track? Are there known issues that should perhaps be linked here?

No known issues AFAIK, the experimental flag will be removed in 3.1.0

#8 Updated by Andre Greeff over 1 year ago

@Jean: Hate to burst your bubble, but I just found a minor syntax issue with the Markdown implementation in 2.6 (which I just logged, see #19880).

#9 Updated by PICCORO LenzMcKAY over 1 year ago

i recently migrated to redmine 3 series, and the firts problem was the markdown.. i'm not happy with that change.. there' lof of issues and the markdown ussage was force due github success that are not complety free...

as always: a company are behing the firts fist! and then everibody change the world!

#10 Updated by dezhi xiong over 1 year ago

Hi,how can I find document about markdown text formatting? I found this link(https://www.redmine.org/projects/redmine/wiki/RedmineTextFormatting), it says for markdown formatting please refer to #15520 . But in this issue, I didn't find any documents. Eg, how can I link to an issue in markdown since # is a special char in markdown?

#11 Updated by dumb blob over 1 year ago

@dezhi Markdown documentation is completely missing. I'd recommend this interactive documentation http://agea.github.io/tutorial.md/ . It's for CommonMark (http://commonmark.org/), so it should be 100% compatible.

Anyway, there seems to be another major issue: HTML tags are not always preserved - e.g. Administration -> Settings -> put <div style="background: red;">abc</div> to the welcome text field; save it and open the welcome page, take a look at the source and there is no div!

Is this feature disabled by default in the bundled redcarpet gem?

#12 Updated by Mischa The Evil over 1 year ago

dezhi xiong wrote:

Hi,how can I find document about markdown text formatting? I found this link(https://www.redmine.org/projects/redmine/wiki/RedmineTextFormatting), it says for markdown formatting please refer to #15520 . But in this issue, I didn't find any documents. [...]

dumb blob wrote:

@dezhi Markdown documentation is completely missing. I'd recommend this interactive documentation http://agea.github.io/tutorial.md/. [...]

Well, there currently isn't an online equivalent of RedmineTextFormatting for Markdown syntax (yet). The reference to this issue was probably added to indicate that Markdown formatting is not what is described in that specific wiki page (and this issue implemented the Markdown formatting).
Starting from not-yet released 3.1.0, Redmine will ship with local help files for Markdown formatting syntax (accessible using the 'Help' button in the editor toolbar [only when Markdown formatting is active]). This is implemented via issue #16373.

@ dumb blob: the more common reference (that will also be used in Redmine >= 3.1.0) is http://daringfireball.net/projects/markdown/syntax.

dumb blob wrote:

[...]
Anyway, there seems to be another major issue: HTML tags are not always preserved - e.g. Administration -> Settings -> put <div style="background: red;">abc</div> to the welcome text field; save it and open the welcome page, take a look at the source and there is no div!
Is this feature disabled by default in the bundled redcarpet gem?

This is something that is not supported by neither the Textile formatting nor the Markdown formatting implementation in Redmine. For the Textile implementation see source:/trunk/lib/redcloth3.rb@14449#L1202, the div tag is not allowed nor recognized. For the Markdown implementation see source:/trunk/lib/redmine/wiki_formatting/markdown/formatter.rb@14449#L122, which tells the Redcarpet gem to filter out any HTML from the user input completely.
FTR: there are currently no known major issues with the Markdown formatter. The only existing minor syntax issue is the one cited by Andre Greeff in note-8.

#13 Updated by dumb blob over 1 year ago

Well, there currently isn't an online equivalent of RedmineTextFormatting for Markdown syntax (yet). The reference to this issue was probably added to indicate that Markdown formatting is not what is described in that specific wiki page (and this issue implemented the Markdown formatting).
Starting from not-yet released 3.1.0, Redmine will ship with local help files for Markdown formatting syntax (accessible using the 'Help' button in the editor toolbar [only when Markdown formatting is active]). This is implemented via issue #16373.

Well, I recommended the CommonMark tutorial http://agea.github.io/tutorial.md/ because of two reasons. First, it's more user friendly and "obvious" for new users. Second, redcarpet is slowly implementing CommonMark features (see github issues).

@ dumb blob: the more common reference (that will also be used in Redmine >= 3.1.0) is http://daringfireball.net/projects/markdown/syntax.

True, but I'm still seeing the tutorial above as more viable (for the two reasons mentioned above).

dumb blob wrote:

[...]
Anyway, there seems to be another major issue: HTML tags are not always preserved - e.g. Administration -> Settings -> put <div style="background: red;">abc</div> to the welcome text field; save it and open the welcome page, take a look at the source and there is no div!
Is this feature disabled by default in the bundled redcarpet gem?

This is something that is not supported by neither the Textile formatting nor the Markdown formatting implementation in Redmine. For the Textile implementation see source:/trunk/lib/redcloth3.rb@14449#L1202, the div tag is not allowed nor recognized. For the Markdown implementation see source:/trunk/lib/redmine/wiki_formatting/markdown/formatter.rb@14449#L122, which tells the Redcarpet gem to filter out any HTML from the user input completely.
FTR: there are currently no known major issues with the Markdown formatter. The only existing minor syntax issue is the one cited by Andre Greeff in note-8.

Actually, this is a huge violation of Markdown (and CommonMark as well). Embedded HTML is the feature making Markdown so widespread. Look at the http://daringfireball.net/projects/markdown/syntax website you linked. It's mentioned there as a major feature (same holds for CommonMark). If you really decide to hardcode this decision of disabling HTML, you can't aim users at the documentation from http://daringfireball.net/projects/markdown/syntax any more. That means make your own, which will emphasize that there is no HTML allowed contrary to standard Markdown/CommonMark (the currently proposed documentation http://www.redmine.org/issues/16373#note-13 doesn't do this).

Also except for missing HTML as a major feature, there are other differences to standard Markdown/CommonMark (new keywords etc.), so this is not anymore standard Markdown/CommonMark and thus it should be named Redmine Markdown (i.e. yet another Markdown flavour), but not just Markdown. This requirement is directly from the original Markdown author John Gruber (author of the page you linked - http://daringfireball.net/projects/markdown/syntax).

#14 Updated by Jean-Claude Wippler over 1 year ago

this is a huge violation of Markdown

I vote for renaming this to Redmine Markdown.

In my years of using Markdown, I've never felt the need for HTML. As this discussion itself illustrates, there is enough richness to use Redmine for its intended purposes as is - some might even say that italic and bold SHOUTING adds preciously little to a discussion, other than heat... (arguments don't become more valid by adding typographical annotations - only more annoying, if you ask me).

I see no problem in pointing to Gruber's original Markdown docs with the note that inline HTML is not supported.

#15 Updated by dumb blob over 1 year ago

In my years of using Markdown, I've never felt the need for HTML. As this discussion itself illustrates, there is enough richness to use Redmine for its intended purposes as is - some might even say that italic and bold SHOUTING adds preciously little to a discussion, other than heat... (arguments don't become more valid by adding typographical annotations - only more annoying, if you ask me).

Usually HTML in Markdown/CommonMark is used for styling non-text content (e.g. inline images - especially to manage their size). So the richness you mentioned doesn't apply for these common cases.

Also let me apologize for emphasizing key points with arguments using typographical annotations - I come from a culture, where shouting is expressed using an exclamation mark (neither with bold nor italic).

I see no problem in pointing to Gruber's original Markdown docs with the note that inline HTML is not supported.

If all the differences between standard Markdown/CommonMark and the Redmine Markdown are mentioned up front, then there is absolutely no issue with pointing to the daringfireball markdown page.

#16 Updated by Andre Greeff over 1 year ago

Mischa The Evil wrote:

[...]
dumb blob wrote:

[...]
Anyway, there seems to be another major issue: HTML tags are not always preserved - e.g. Administration -> Settings -> put <div style="background: red;">abc</div> to the welcome text field; save it and open the welcome page, take a look at the source and there is no div!
Is this feature disabled by default in the bundled redcarpet gem?

This is something that is not supported by neither the Textile formatting nor the Markdown formatting implementation in Redmine.
[...]
For the Markdown implementation see source:/trunk/lib/redmine/wiki_formatting/markdown/formatter.rb@14449#L122, which tells the Redcarpet gem to filter out any HTML from the user input completely.

Is there any specific reason for that..? I just turned off the HTML filter in my instance and I don't see any immediate issues.

I recently migrated my DB over to 2.6.6 from a 2.5.2 instance where we were using CKEditor. All my previous content (50+ projects, almost 1000 issue reports, +/- 600 wiki pages, etc..) was all saved as HTML thanks to CKeditor, but the move over to Markdown should be pretty painless since it renders to HTML anyway. The end result should have no difference in the rendering. As "dumb blob" (really..?) pointed out, stripping out the HTML sort of defeats the purpose here, so I can't imagine that choice was without a good reason..

As per the DaringFireball page you (Mischa) linked to:

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

Either way, now that I know it's just configuration, I'll just have to run with this disabled on my side for now. However, I really think this should either be disabled or at least made to be optional.

At this rate we may even need a whole new configuration page for "Redmine formatting" one day. :)

#17 Updated by mc0e . over 1 year ago

Mischa The Evil wrote:

Is there any specific reason for that..? I just turned off the HTML filter in my instance and I don't see any immediate issues.

Allowing direct insertion of html opens up a variety of attacks for purposes like stealing session cookies from other users, and click-jacking attacks on other sites. A very careful filtering of submitted html can mostly prevent this, but it's very easy to make mistakes and leave vulnerabilities open.

No doubt there are redmine sites which are open to use only by trusted users, and then it might be quite safe to allow html, but this is not always the case.

#18 Updated by Go MAEDA over 1 year ago

Please create a new issue for a feature request. This issue is closed.

#19 Updated by dumb blob over 1 year ago

A new issue http://www.redmine.org/issues/20497 on Markdown with HTML is created. Fell free to add yourself to watchers.

#20 Updated by Go MAEDA over 1 year ago

  • Related to Feature #20497: Markdown formatting supporting HTML added

#21 Updated by Go MAEDA about 1 year ago

  • Duplicated by Feature #14260: Simplify the syntax highlighting added

#23 Updated by Adrien Crivelli 6 months ago

A quick note for people looking for a tool to convert textile to markdown. There is a rake task that can do that: https://github.com/Ecodev/redmine_convert_textile_to_markown

#24 Updated by Hiroo Hayashi 6 months ago

I updated RedmineTextFormattingMarkdown.
I added the following sentence at the top of the page;

Currently HTML tags are not allowed by default. See #15520 and #20497 for details.

I tried to make the Markdown wiki page compatible with the Textile wiki page as far as I could. I added some examples using HTML tags where they were required.

See #16373 and #23413 for more details.

#25 Updated by Charles Sporkman 3 months ago

Perhaps this is a silly question, but is Markdown supported at all outside of wiki pages? I have people begging for it in areas like this one right here we're looking at - the issue tracker.

#26 Updated by Adrien Crivelli 3 months ago

Yes markdown is supported everywhere where textile is supported, including issues, as long as you select the markdown format in Redmine global settings.

Also available in: Atom PDF