Skip to content

Commit

Permalink
Trim leading/trailing
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Wirtz committed Mar 11, 2013
1 parent 20a2177 commit 490b3e2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,10 +811,10 @@ Parser.prototype.parseText = function() {
* Strip HTML
*/
Parser.prototype.parseAnchor = function(s) {
return s.replace(/<(?:.|\s)*?>/g, "") // Strip HTML
.replace(/&(#[\d]+|[\w]+);/, "-") // Replace entities with "-"
.replace(/[^\w\d_\-]+/g, "-") // Convert non alphanumeric characters to "-"
.replace(/^[\-]+|[\-]+$/, ""); // Strip leading/trailing "-"
return s.replace(/<(?:.|\s)*?>/g, "") // Strip HTML
.replace(/&(#[\d]+|[\w]+);/g, "-") // Replace entities with "-"
.replace(/[^\w\d_\-]+/g, "-") // Convert non alphanumeric characters to "-"
.replace(/^[\-]+|[\-]+$/g, ""); // Strip leading/trailing "-"
};

/**
Expand Down

0 comments on commit 490b3e2

Please sign in to comment.