[kramdown-users] using kramdown in xhtml

Matt Neuburg matt at tidbits.com
Thu Jun 10 12:15:12 EDT 2010

On or about 6/10/10 6:15 AM, thus spake "Thomas Leitner" <t_leitner at gmx.at>:

>> I think what I'd really like is the option for actual *characters* to
>> be output. Only two characters must be entityized: ampersand and
>> less-than. But that's all. I'm making UTF-8 encoded Web pages and I'm
>> starting with UTF-8 encoded Markdown / kramdown, so all the
>> characters I'm using are legal as they stand. I don't need them
>> transformed at all. I type my own em-dashes, ellipses, Ancient Greek,
>> etc. The only things I'm not typing myself are the curly quotes and
>> curly apostrophe. I think Smartypants produces entities for its curly
>> quotes etc. only because it doesn't know what encoding I'll be using.
>> But I do know! :) So I'd be happiest if kramdown's Smartypants
>> function allowed me to specify that I just want characters for any
>> transformations it produces. Then I'd be able to read my own XHTML.
> I won't implement this on Ruby 1.8 because of the lack of string
> encoding support. However, the feature you want is already on my TODO
> list. It will convert entities, smart quotes and typographic symbols
> (as handled by the kramdown parser) into their character equivalences
> on output - but only under Ruby 1.9. One more incentive to switch from
> 1.8 to 1.9 ;-)

Ouch! :) So I take it that iconv doesn't count as string encoding support?
Oh, wait - you mean that you can't count on kramdown *itself* (i.e. literal
strings in the kramdown file) being interpreted properly with respect to
encoding. TextMate will interpret Ruby files as UTF-8; that's what I use, so
I'm used to that, and I rely on the assumption that that's what I *will*
use. But someone might run kramdown in some other milieu. I never thought of
that. :)))

>> On the other hand if I were producing output for a non-UTF-8 milieu
>> then everything that isn't ASCII must be entityized. In that case,
>> only numeric entities make sense, because there are no named entities
>> for most of the characters I use. m.
> This won't be done in kramdown. The kramdown parser (as well as the new
> HTML parser) doesn't convert between encodings or change normal
> characters to entities. Whatever string you give to kramdown comes out
> in the same encoding.

Sounds great. m.

matt neuburg, phd = matt at tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
Take Control of Exploring & Customizing Snow Leopard
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com

More information about the kramdown-users mailing list