Skip to content

Commit

Permalink
Add support for data-url to create anchor tag
Browse files Browse the repository at this point in the history
This allows the HTML API to create links in the Toolbar.
  • Loading branch information
mAAdhaTTah committed Oct 9, 2016
1 parent 4549892 commit 961e435
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion plugins/toolbar/prism-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,15 @@

var text = pre.getAttribute('data-label');

var element = document.createElement('span');
var element;

if (pre.hasAttribute('data-url')) {
element = document.createElement('a');
element.href = pre.getAttribute('data-url');
} else {
element = document.createElement('span');
}

element.textContent = text;

return element;
Expand Down
2 changes: 1 addition & 1 deletion plugins/toolbar/prism-toolbar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 961e435

Please sign in to comment.