Feature #20511

Comments for Textile text formatting

Added by Julius Friedrich about 7 years ago. Updated 7 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:


Category:Text formatting
Target version:5.0.0


Developing and maintaining a wiki page I often would like to add some hidden commentary which does not show in formatted view.

I think there is no way to do this at the moment. Code for Textile Comments is filtered and does not work.

Disfunctional Textile examples:


I know there is a plugin for this. I hope it will be made a core functionality soon. Cheers!

20511.patch Magnifier (2.75 KB) Go MAEDA, 2022-03-11 06:05

Related issues

Related to Redmine - Feature #6269: RedCloth 4 support New
Related to Redmine - Feature #3564: Invisible comments Closed 2009-06-30
Related to Redmine - Defect #1160: HMTL-Tags Closed 2008-05-01

Associated revisions

Revision 21457
Added by Go MAEDA 7 months ago

Comments for Textile text formatting (#20511).

Patch by Go MAEDA.


#1 Updated by Serg Astra almost 6 years ago


#2 Updated by Joel SCHAAL over 5 years ago

I stumbled across the same issue today, and wondered what I was doing wrong.
This marks Textile as not fully supported by Redmine for me (contrarily to what is written here: Wiki formatting > Text formatting).

Is Textile going to be abandoned in favor of Markdown ? I guess this issue would then be obsolete...

#4 Updated by Go MAEDA over 1 year ago

#5 Updated by Go MAEDA over 1 year ago

#6 Updated by Go MAEDA 8 months ago

CommonMark Markdown (#32424) that is going to be introduced in Redmine 5.0.0 supports HTML comments. I think it would be nice if Textile supports HTML comments as well.

The following code adds HTML comments support to the Textile formatter.

diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb
index 2816e1c90..274f9cef8 100644
--- a/lib/redmine/wiki_formatting/textile/redcloth3.rb
+++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb
@@ -298,6 +298,7 @@ class RedCloth3 < String
         @pre_list = []
         rip_offtags text
         no_textile text
+        clean_html_comment text
         escape_html_tags text
         # need to do this before #hard_break and #blocks
         block_textile_quotes text unless @lite_mode
@@ -1217,4 +1218,8 @@ class RedCloth3 < String
+    def clean_html_comment(text)
+        text.gsub!(/^<!--[\s\S]*?-->$/, '')
+    end

#7 Updated by Go MAEDA 7 months ago

#8 Updated by Go MAEDA 7 months ago

  • File 20511.patchMagnifier added
  • Target version set to Candidate for next major release

Here is a patch.

HTML comments in Textile are escaped since r1403. This patch may appear to roll back that change, but I think it is not a problem. This is because the purpose of the change is to prevent mistakenly entered unclosed comments from affecting page rendering (see #1160) and unclosed comments are still escaped even after applying the patch. It is ensured by the test source:trunk/test/helpers/application_helper_test.rb@21440#L1304.

#9 Updated by Go MAEDA 7 months ago

  • Target version changed from Candidate for next major release to 5.0.0

Setting the target version to 5.0.0.

#10 Updated by Go MAEDA 7 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch.

Also available in: Atom PDF