mwunsch / tumblr

Command line interface and Ruby client for the Tumblr API (v2)
MIT License
282 stars 43 forks source link

Blockquote Markdown bug in caption and description #2

Closed mottram closed 14 years ago

mottram commented 14 years ago

Tiny bug: when writing a caption for photo posts, and a description for link posts, the Tumblr gem strips out a leading >, making it impossible to use Markdown blockquotes.

Eg:


---
type: link
format: markdown
description: > A quote from the _linked_ page, [including another link](http://example.com)

---
http://example.com

Will end up on Tumblr without the >, but with the rest of the markdown processed fine. (Double blockquotes - >> - work, though.)

mwunsch commented 14 years ago

This isn't so much a bug with Tumblr as it is an error in YAML's interpretation of your string. Remember that Tumblr just uses YAML frontmatter, which means it just runs this block through a YAML parser.

So YAML is handling the description string in an odd way here. What I suggest, is read up on how YAML does strings (Scalars):

description: A quote from the linked page

Is really just short for

"description": "A quote from the linked page"

You can get around this issue by putting the description in quotes:

"> A quote from the _linked_page..."

If you look at the YAML spec, at it's handling of scalars, you'll see that the character > has special significance. Quote or use the | character to escape the sequence.

mottram commented 14 years ago

Ah, apologies for assuming it was the Tumblr gem's fault.