[kramdown-users] smartypants-only switch

Thomas Leitner t_leitner at gmx.at
Sun Aug 8 14:19:17 EDT 2010

On 2010-08-06 10:48 -0700 Matt Neuburg wrote:
> This may have already been answered and I may have dropped the ball;
> if so, I apologize.
> In Frontier, and in RubyFrontier, my Web site framework has applied
> Markdown and SmartyPants in two separate stages. The reason is that
> SmartyPants is smart about making quotes and apostrophes curly
> throughout the *whole* page
> - it stays out of tags and the insides of <code> and <tt>, but it
> dives into all other displayed content and makes curly quotes.
> Now, kramdown lacks this; it is all or nothing. If you say
> <...markdown="1">, everything inside that tag gets the ENTIRE markdown
> treatment, plus smartypants treatment. But for something like the
> <title> tag, this is a bit heavy-handed. I'd like to be able to say
> <title smartypants="1">, or maybe <title markdown="smarty">, so that
> kramdown will apply its *only* curly-quoting smartification inside
> the <title> tag without wasting time looking for *any* other Markdown
> material.
> Indeed, asterisks inside the <title> tag should be legal without
> triggering an incorrect additional tag inside the tag. So for example:
> <title markdown="smarty">Isn't this a *test*?</title>
> Would yield:
> <title>Isn&#8217;t this a *test*?</title>
> But perhaps there is already a better way to do this and I've
> forgotten what it is...?

No, there is currently no way to do this except by subclassing the
kramdown parser and removing the parsers for the smart quotes. The you
can use kramdown without in-built smartpants support and use rubypants
to do the smartypants part.

-- Thomas

More information about the kramdown-users mailing list