Skip to content

Commit

Permalink
Allow HTML in permalink symbol
Browse files Browse the repository at this point in the history
Closes #8.
  • Loading branch information
valeriangalliat committed Aug 13, 2015
1 parent de1c410 commit e137c5d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased][unreleased]
* Allow to pass HTML as permalink symbol. ([#8])

## [2.2.1] - 2015-08-13
* Do not crash when permalink is enabled and headers below specified
Expand Down Expand Up @@ -55,3 +56,4 @@ This project adheres to [Semantic Versioning](http://semver.org/).
[#3]: https://github.com/valeriangalliat/markdown-it-anchor/issues/3
[#5]: https://github.com/valeriangalliat/markdown-it-anchor/issues/5
[#7]: https://github.com/valeriangalliat/markdown-it-anchor/issues/7
[#8]: https://github.com/valeriangalliat/markdown-it-anchor/issues/8
2 changes: 1 addition & 1 deletion index.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const renderPermalink = (slug, opts, tokens, idx) => {
['aria-hidden', 'true']
]
}),
assign(new Token('text', '', 0), { content: opts.permalinkSymbol }),
assign(new Token('html_block', '', 0), { content: opts.permalinkSymbol }),
new Token('link_close', 'a', -1)
]

Expand Down
5 changes: 5 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ equal(
'<h1 id="h1">H1 <a class="header-anchor" href="#h1" aria-hidden="true">P</a></h1>\n'
)

equal(
md().use(anchor, { permalink: true, permalinkSymbol: '<i class="icon"></i>' }).render('# H1'),
'<h1 id="h1">H1 <a class="header-anchor" href="#h1" aria-hidden="true"><i class="icon"></i></a></h1>\n'
)

equal(
md().use(anchor).render('# Title\n\n## Title'),
'<h1 id="title">Title</h1>\n<h2 id="title-2">Title</h2>\n'
Expand Down

0 comments on commit e137c5d

Please sign in to comment.