Comments
-
Greg Hurrell
Initialization
If you're using this in the context of a Rails app, you could put initialization in a
config/initializers/wikitext.rb
file; here's an example from a project of mine:# Override example "wikitext/preprocess" that comes with wikitext gem. class String def wikitext_preprocess self. # autolink hashtags, but only ones containing at least one letter gsub( %r{ (^|\s) # only at start of line/after space \#( # will match a hashtag (?:[a-z0-9]*[a-z][a-z0-9]*)+ # "word" containing at least 1 letter (?:\.[a-z0-9]*[a-z][a-z0-9]*)* # 0 or more ".word" )\b }ix, '\1[/tags/\2 #\2]' ). # same as in wikitext/preprocess: gsub(/\b(bug|issue|request|ticket) #(\d+)/i, '[/issues/\2 \1 #\2]') end end
Note that the
#to_wikitext
method will use a shared parser instance by default, so you can just configure that eg. you could do:parser = Wikitext::Parser.shared_parser parser.internal_link_prefix = '/foo/'
Floating
At the moment there is no built-in way to do this. You could target
img
tags via CSS, but in order to be flexible we'd need to provide a way to allow a class to be included in the image syntax. I haven't really thought about what that should be, but I'm guessing something like{left:image.jpg}
or similar. The question I'd wonder would be, should we allow arbitrary classnames, or restrict it to a whitelist? Whatever it was, it should be gated behind an option, for security. -
anonymous
Hi,
I think that providing a limited number of class (left, right, hidden) by default could be a good idea, and in a second time, adding an option to accept non standard class (arbitrary classnames) could cover most of the cases. But as you said, it could be problematic and bad used by the user so an option for the developer is essential to avoid problems.
Just a question : does wikitext come with a CSS file ? If it's not the case, maybe leave to the user the choice of the class to apply (I'm thinking to bootstrap users like me for example).
-
Greg Hurrell
does wikitext come with a CSS file
Nope, it's not opinionated about how things should be styled.
Add a comment
Comments are now closed for this issue.