Skip to content

Commit

Permalink
Fixed #288: Some character combinations involving a dollar sign in in…
Browse files Browse the repository at this point in the history
…line code would render incorrectly
  • Loading branch information
adam-p committed Jul 14, 2015
1 parent 1a26287 commit 498d796
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/common/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ Change Log
### Voting is complete and the [**new Markdown Here logo**](http://markdown-here.com/logo.html) has been chosen by the users!


2015-06-xx: v2.11.10
2015-xx-yy: v2.11.10
--------------------

* [Fixed bug #283](https://github.com/adam-p/markdown-here/issues/283): Forgot-to-render detection was broken for Google Inbox. Thanks to [Marvin R.](https://github.com/therealmarv).
- If you find that the forgot-to-render detection gets broken for the Gmail or Google Inbox web interfaces, please post to the ["markdown-here" Google Group](https://groups.google.com/group/markdown-here) or create [an issue in the Github project](https://github.com/adam-p/markdown-here/issues). The MDH code that hooks into the web UI is brittle and might break when Google changes stuff.

* [Fixed bug #288](https://github.com/adam-p/markdown-here/issues/288): Some character combinations involving a dollar sign in inline code would render incorrectly. Thanks to [rfulkerson](https://github.com/rfulkerson).


2015-05-26: v2.11.9
-------------------
Expand Down
7 changes: 6 additions & 1 deletion src/common/mdh-html-to-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,12 @@ function convertHTMLtoMarkdown(tag, html) {
});

for (var i = 0; i < htmlToRestore.length; i++) {
html = html.replace(htmlToRestore[i][0], htmlToRestore[i][1]);
html = html.replace(htmlToRestore[i][0], function() {
// The replacement argument to `String.replace()` has some magic values: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter
// Because we don't control the content of that argument, we either
// need to escape dollar signs in it, or use the function version.
return htmlToRestore[i][1];
});
}
}
else {
Expand Down
8 changes: 8 additions & 0 deletions src/common/test/mdh-html-to-text-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ describe('MdhHtmlToText', function() {
expect(get(html)).to.equal(target);
});

// Test the fix for bug https://github.com/adam-p/markdown-here/issues/288
// Use of dollar sign in inline code producing odd results
it('should properly handle a dollar sign in inline code', function() {
var html = '`$`';
var target = '`$`';
expect(get(html)).to.equal(target);
});

});

describe('MdhHtmlToText (check-for-MD mode)', function() {
Expand Down

0 comments on commit 498d796

Please sign in to comment.