Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "bower_components"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bower_components/
node_modules
3 changes: 2 additions & 1 deletion markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ angular.module('btford.markdown', ['ngSanitize']).
element.html(html);
});
} else {
var html = $sanitize(markdownConverter.makeHtml(element.text()));
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
var html = $sanitize(markdownConverter.makeHtml(element.text().replace(rtrim, '')));
element.html(html);
}
}
Expand Down
6 changes: 6 additions & 0 deletions markdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ describe('btfMarkdown', function () {
expect(elt.html()).toBe('<p><em>hi</em></p>');
});

it('should trim spaces', function () {
var elt = angular.element('<btf-markdown> *hi* </btf-markdown>');
$compile(elt)($rootScope);
expect(elt.html()).toBe('<p><em>hi</em></p>');
});

it('should work as an attribute', function () {
var elt = angular.element('<div btf-markdown>*hi*</div>');
$compile(elt)($rootScope);
Expand Down