Redmine Markdown



對於諸如標題、粗體、表格、清單等項目, Redmine 支援使用 Markdown 語法。. Redmine 為每一種標題指定一個 HTML 錨定 (anchor. Commonly used symbols in R Markdown. Commonly used symbols in R Markdown. There were attempts to add different syntaxes to Redmine Wiki but the only successful and still active non-native Wiki syntax plugin is the Markdown Redcarpet plugin (This plugin replaced the default Redmine formatter with the Markdown formatter, which uses the Redcarpet library.

  1. Redmine Markdown Link
  2. Redmine Markdown Plugin
  3. Redmine Textile
  4. Redmine Markdown Image

how to allow html tag in redmine wiki

Hello,

My wiki settings are such that it uses Markdown (and not Textile) formatting.

My goal here is to be able to color text.

I found in the user guide for markdown formatting
that html tags must be allowed for this to work:

Note: HTML tags need to be allowed to use the HTML tag (<span>). See #15520-16 and #15520-17 for details.

I went over the linked issues but I only saw warnings on why this should not be done for security reasons.
I have to admit I did not read the entire issues.

At the top of the user guide it also says:

Currently HTML tags are not allowed by default. See #15520 and #20497 for details. For other limitations of the current Markdown formatting see #16373 and #21443.

But I can't find how to allow HTML tags.
Is there a configuration/setting for this ?

Or does the code need to be patched e.g. https://www.redmine.org/projects/redmine/repository/revisions/14449/entry/trunk/lib/redmine/wiki_formatting/markdown/formatter.rb#L122

Thanks in advance for your help.

Replies (5)

RE: how to allow html tag in redmine wiki - Added by Ivan Cenovover 2 years ago

You may use macro html this way:
Example

The macro should be inserted in <path_to_redmine>/lib/redmine/wiki_formatting/macros.rb somewhere among other macros there:

Don't forget to restart Redmine.

RE: how to allow html tag in redmine wiki - Added by Tuan-Tu Tranover 2 years ago

Hello

Thank you for your answer.

However I was hoping for something more integrated with the markdown, as described here in the user documentation:
https://www.redmine.org/projects/redmine/wiki/RedmineTextFormattingMarkdown#Color

with an html macro as you proposed, I guess I'd have to do things like:

to achieve the same list, which is much less convenient.

The note in the user documentation

Note: HTML tags need to be allowed to use the HTML tag (<span>). See #15520-16 and #15520-17 for details.

Redmine markdown html

suggests there's a straightforward way to just allow the HTML tag <span>

I just can't seem to find it and that was more the object of my initial question.

Thanks again.

RE: how to allow html tag in redmine wiki - Added by Tuan-Tu Tranover 2 years ago

Hello,

I'm bumping up this question.

I hope someone can help.

Thanks!

RE: how to allow html tag in redmine wiki - Added by Odare Abisam Odareabout 2 years ago

Hi!

You can change it here

redmine/lib/redmine/wiki_formatting/markdown/formatter.rb

I changed the boolean from true to false for filter_html

Then restart redmine

RE: how to allow html tag in redmine wiki - Added by Tuan-Tu Tranabout 1 year ago

Thanks.

I've updated the documentation accordingly:
https://www.redmine.org/projects/redmine/wiki/RedmineTextFormattingMarkdown/diff?utf8=%E2%9C%93&version=26&version_from=24&commit=View+differences

Now that I re-read this, it was indeed pointed out in #15520#note-16 but it was not very explicit:

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.

(1-5/5)

Feature #15520

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

Associated revisions

Redmine markdown html

Revision 12452

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

Revision 12461

Redmine

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

Revision 14244

Removed experimental flag on markdown format (#15520).

History

#1 Updated by Jan Niggemann (redmine.org team member)over 7 years ago

  • Tracker changed from Defect to Feature

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

#2 Updated by Anonymous over 7 years ago

#3 Updated by ixbidie ixbidieover 7 years ago

there is a plugin implementing exactly this.

#4 Updated by Jean-Philippe Langover 7 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 Wipplerover 7 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 .almost 6 years 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 Langalmost 6 years 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 Anonymous almost 6 years 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 LenzMcKAYalmost 6 years 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 xiongalmost 6 years 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 blobalmost 6 years 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>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 Evilalmost 6 years 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>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 blobalmost 6 years 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>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 Wippleralmost 6 years 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 blobalmost 6 years 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 Anonymous over 5 years 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>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.

Redmine Markdown Plugin

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 5 years 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 MAEDAover 5 years ago

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

Redmine Textile

#19 Updated by dumb blobover 5 years 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 MAEDAover 5 years ago

  • Related toFeature #20497: Markdown formatting supporting HTML added

#21 Updated by Go MAEDAover 5 years ago

  • Duplicated byFeature #14260: Simplify the syntax highlighting added

#22 Updated by Viktor Berkeabout 5 years ago

#23 Updated by Adrien Crivellialmost 5 years 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 Hayashialmost 5 years ago

Redmine Markdown Image

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 Sporkmanover 4 years 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 Crivelliover 4 years ago

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

#27 Updated by Bintintan Andreiabout 1 year ago

  • FileScreenshot_45.png added

Hiroo Hayashi wrote:

I updated RedmineTextFormattingMarkdown.
I added the following sentence at the top of the page;
See #16373 and #23413 for more details.

Redmine Markdown

In RedmineTextFormattingMarkdown there are examples of HTML code, but they are not working. Is this a problem in the documentation, do they not work, or do I have a setting problem?

See attached screenshot.

Also available in: AtomPDF