robwierzbowski/jekyll-picture-tag — pull request #31 by obxdesignworks (2014-02-26 01:08:59+00:00)
Title: Patch: fix markdown indentation

This pull request (PR) first merges changes from johnfmorton@d26f72b to fix the `{::nomarkdown}{:/}` error in the output. It also fixes an issue where adding spaces for indentation to the generated code caused markdown to convert the output to an HTML code block. I added an markdown escape sequence ("\ ") and used inline string iteration over the sequence to escape the resulting output:

```Ruby
# Line: 102
# used to escape markdown parsing rendering below
markdown_escape = "\ "

# Line: 154
source_keys.reverse.each { |source|
media = " data-media=\"#{instance[source]['media']}\"" unless source == 'source_default'
source_tags += "#{markdown_escape * 4}\n"
}

# Note: we can't indent html output because markdown parsers will turn 4 spaces into code blocks
# Note: Added backslash+space escapes to bypass markdown parsing of indented code below -WD
picture_tag = "\n"\
"#{source_tags}"\
"#{markdown_escape * 4}\n"\
"#{markdown_escape * 2}\n"

# Line: 171
source_keys.each { |source|
if source == 'source_default'
source_tags += "#{markdown_escape * 4}\n"
else
source_tags += "#{markdown_escape * 4}\n"
end
}

# Note: we can't indent html output because markdown parsers will turn 4 spaces into code blocks
picture_tag = "\n"\
"#{source_tags}"\
"#{markdown_escape * 4}

#{html_attr['alt']}

\n"\
"#{markdown_escape * 2}"
```

All changes in this branch were tested on redcarpet, kramdown, and maruku using both markup patterns.