Skip to content

Commit

Permalink
Escape html in tag and bump markdown-it
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen van Bergerem committed Jan 11, 2015
1 parent 1cc9321 commit a5c59ee
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.2.2

* Move the class attribute to the end
* Escape html in the tag
* Bump markdown-it

# 0.2.1

* Update files in /dist
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function isLinkClose(str) { return /^<\/a\s*>/i.test(str); }
module.exports = function hashtag_plugin(md, options) {

var arrayReplaceAt = md.utils.arrayReplaceAt;
var escapeHtml = md.utils.escapeHtml;

function hashtag(state) {
var i, j, l, m,
Expand Down Expand Up @@ -110,7 +111,7 @@ module.exports = function hashtag_plugin(md, options) {
});
nodes.push({
type: 'hashtag_text',
content: tagName,
content: escapeHtml(tagName),
level: level
});
nodes.push({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"eslint-plugin-nodeca": "^1.0.0",
"istanbul": "*",
"lodash": "*",
"markdown-it": "~3.0.1",
"markdown-it": "~3.0.3",
"markdown-it-testgen": "~0.1.0",
"mocha": "*",
"request": "*",
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/hashtag/options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ missing preceeding#space
.
#<3
.
<p><a href="/tags/<3" class="tag">#<3</a></p>
<p><a href="/tags/<3" class="tag">#&lt;3</a></p>
.

.
#<3 and other #hashtags
.
<p><a href="/tags/<3" class="tag">#<3</a> and other <a href="/tags/hashtags" class="tag">#hashtags</a></p>
<p><a href="/tags/<3" class="tag">#&lt;3</a> and other <a href="/tags/hashtags" class="tag">#hashtags</a></p>
.

.
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/markdown-it/commonmark_extras.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ Issue #55:
.


Issue #35. `<` shoud work as punctuation
.
an **(:**<br>
.
<p>an <strong>(:</strong><br></p>
.


Should unescape only needed things in link destinations/titles:
.
[test](<\f\o\o\>\\>)
Expand Down

0 comments on commit a5c59ee

Please sign in to comment.