问题
I am currently looking for a markup language to use in a project. I want to allow site vistors to edit a wiki like page using a markup language (not HTML).
I am implementing this site in Ruby on Rails, and would prefer (although not bound) to use something that already has strong support in the form of a gem.
There are a few main things I am looking for in a markup language:
It needs to be easy to use for a non-technical crowd.
It needs to be safe from cross site scripting attacks.
It needs to be relatively useful for general purpose markup found in wiki pages.
Ideally support would have be there in the form of a gem.
Ideally a WYSIWYG editor (or at least an editor with helpers like the one on SO) would exist.
From a brief survey of the popular markup language I am inclined to go with Markdown, only because it seems to have good support in RoR and (if I am not mistaken) it also appears to be free from cross site scripting exploits.
Are these valid observations? What down falls are there to going with Markdown? What other concerns would you look at when choosing a markup language? And most importantly, which markup language would you choose?
Any and all information would be appreciated.
As a side note, I've already looked at Compare and contrast the lightweight markup languages and it didn't directly address my concerns, but perhaps would be helpful for those looking at this question.----
回答1:
How about Creole?
That seems to be well suited for wikis, and looks to have Ruby support and since it also has Javascript support, so an editor similar to SO's can be crafted.
See:
Creole-to-HTML converter
JavaScript Creole 1.0 Wiki Markup Parser
回答2:
This seems old but I've found an answer which is a gem called "redcarpet" https://github.com/vmg/redcarpet http://rubygems.org/gems/redcarpet
回答3:
Personally I'd use an html scrubber such as loofah to sanitize rather than depending on markup, certainly it's useful to allow some html. I personally recommend markdown with wmd wysiwym editor which is what SO use; in fact they're pretty much maintaining it these days. Being able to separate link and image urls to the bottom of the markup is very worthwhile and far user friendlier.
来源:https://stackoverflow.com/questions/4008212/which-markup-language-markdown-or