Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix over-zealous backslash replacement #378

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/redcarpet/markdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ char_quote(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t offse
static size_t
char_escape(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t offset, size_t size)
{
static const char *escape_chars = "\\`*_{}[]()#+-.!:|&<>^~=";
static const char *escape_chars = "`*_{}[]()#+-.!:|&<>^~=";
struct buf work = { 0, 0, 0, 0 };

if (size > 1) {
Expand Down
6 changes: 6 additions & 0 deletions test/markdown_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ def test_that_html_blocks_do_not_require_their_own_end_tag_line
assert_equal expected, output
end

def test_that_backslashes_escape_properly
output = render("visit \\\\server\\path \\**now**")
expected = "<p>visit \\\\server\\path *<em>now</em>*</p>"
assert_equal expected, output
end

# This isn't in the spec but is Markdown.pl behavior.
def test_block_quotes_preceded_by_spaces
output = render <<-Markdown.strip_heredoc
Expand Down