Insert HTML fragments
Added by Adrian Tarau over 3 years ago
There is any possibility to insert HTML fragments in wiki/project description?
I have to insert a link(with an image) back to java.net on project overview page.
Thanks.
Replies (5)
RE: Insert HTML fragments - Added by Adrian Tarau over 3 years ago
Hmmm, not possible? :)
If not I think it should be added. Any opinions?
RE: Insert HTML fragments - Added by Billy T almost 3 years ago
I would like to have it with Redmine.
It may not be a plugin, just a macro in wiki editor, like
{{html(
...
)}}
RE: Insert HTML fragments - Added by Gary Mueller over 1 year ago
I was looking for similar functionality and so I added a simple macro to macros.rb. Here is the code snippet.
desc "Insert html" + "\n\n" +
" !{{html(html block)}}"
macro :html do |obj, args|
return CGI::unescapeHTML(args.join(","))
end
I wouldn't advise this for a public install but for small groups where you feel comfortable allowing your users to enter html it should work fine.
Good Luck
RE: Insert HTML fragments - Added by Adrian Tarau over 1 year ago
Sounds good, thanks. How do I use it ? ;)
RE: Insert HTML fragments - Added by Gary Mueller over 1 year ago
- Paste the above code into lib/redmine/wiki_formatting/macros.rb
- You'll see a bunch of other macros in there. Just paste the code in the same area.
- save
- restart redmine
Example uses
iframe
{{html(
<iframe width="90%" height="250" src="http://en.wikipedia.org/wiki/Redmine"></iframe>
)}}
thumbnail (although you can paste images with textile, note that i am setting the size here)
{{html(
<IMG SRC="http://www.redmine.org/attachments/4091/Redmine-Logo-CyberSprocket-Composite.png" WIDTH="50" HEIGHT="50">
)}}
any other html tags you can think of. I chose these as they extend the current wiki capabilities
You can use the macro to dress up wiki pages, project overview pages, issues, issue notes and to some extent repository commits
Note: if your html contains a closing curly brace you'll need to escape it by changing it to } This is because otherwise the wiki formatter will prematurely close out the macro body
Its actually very simple to implement and use. Let me know if it works out for you.
(1-5/5)