Forums » Development »
Can't use CSS styling in redcarpet+markdown vs. traditional textile
Added by Ben Blanco almost 9 years ago
Hi All,
I'm migrating the content of a redmine server from textile
to markdown
, and have discovered the following limitation:
In Textile, it's super easy to add some inline CSS to customize some text or even a table, using %{background:yellow;color:red;padding:0 10px}some inline CSS%
for example.
With Markdown, tweaking CSS wasn't planned
So one has to use <span style="background:yellow;color:red;padding:0 10px">some inline CSS</span>
But redmine's redcarpet is configured by default to escape such <span>
tags.
I've looked at the redcarpet gem's info, and have tried to set :no_styles => false
on redmine's formatter, but as far as I can tell it's being overriden by :filter_html => true
Switching :filter_html => false
is not an option, as then it allows users to inject "anything", such as <script src="http://bad.net/bad.js"></script>
def formatter
@@formatter ||= Redcarpet::Markdown.new(
Redmine::WikiFormatting::Markdown::HTML.new(
#:no_styles => false,
:filter_html => true,
:hard_wrap => true
),
#:no_styles => false,
:autolink => true,
:fenced_code_blocks => true,
:space_after_headers => true,
:tables => true,
:strikethrough => true,
:superscript => true,
:no_intra_emphasis => true,
:footnotes => true
)
end
I see redmine's RedmineTextFormattingMarkdown hasn't yet changed CSS styling references from Textile.
Any thoughts on what could be done to allow for inline CSS when using Markdown in redmine?