From: Quintus Date: 2011-12-04T22:29:12+09:00 Subject: RedCloth: Adding custom verbatim tag -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi there, I’m using RedCloth for writing texts, it however doesn’t know anything about syntax highlighting. So I came up with the idea of combining it with CodeRay by means of adding a new tag. This is my code so far: ====================================================================== require "redcloth" require "coderay" module RedCloth::CodeRayHighlighting def coderay(opts) CodeRay.scan(opts[:text], :ruby).html(line_numbers: :table, wrap: :div) end end RedCloth::Formatters::HTML.send(:include, RedCloth::CodeRayHighlighting) text=<
puts &#8216;Hi!&#8217;<br />
puts 3
====================================================================== RedCloth obviously converted the quotes into ‘ and ’. CodeRay interpreted the # as the start of a comment and as a result the syntax highlighting is completely broken. How to tell RedCloth that my custom tag wants verbatim text rather than formatted? Vale, Marvin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJO23VwAAoJELh1XLHFkqhaG00H/3ZkZbOKxvrKvW8RWYpQ40II cOggobWNYUlhMDPGrfPCEuhFeIaebk1iwawzD4HxLpooj8s2rmA1GZS3WV15nPpq Tg0whGgiBF0GJZGGDZeoZ1yhPIZ7XzZUcZwXh4eWuhi2TIGX5E9Dz6UzJ20jtG2b SVw861vAzPRZqExsut2rldbidjfAQGXdR8mB7I4MxOeWF5cr+65/KiIViqD4rWtu S53Ja34rnS2Osibt0HYG6VCWDa9uXecMy3zGka//4p82kc9nPZqESfqXEAntaHe3 dGEZf2Mjp7LxQZVOt2mSnD+KRQASoBm8o+fWQwCQUuVw62Hq9Q67EzWIdlxKRX8= =uSic -----END PGP SIGNATURE-----