projects
/
blerg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f13f6cb
)
Add italic/bold markdown syntax
author
Chip Black
<bytex64@bytex64.net>
Mon, 10 Jan 2011 10:17:46 +0000
(
02:17
-0800)
committer
Chip Black
<bytex64@bytex64.net>
Mon, 10 Jan 2011 10:17:46 +0000
(
02:17
-0800)
www/js/blerg.js
patch
|
blob
|
history
diff --git
a/www/js/blerg.js
b/www/js/blerg.js
index
737d84c
..
2ee3467
100644
(file)
--- a/
www/js/blerg.js
+++ b/
www/js/blerg.js
@@
-252,6
+252,10
@@
function mangleRecord(record, template) {
// Turn markdown links into links
record.data = record.data.replace(/(\s|^)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/[^)]*?)?)\)/, '$1<a href="$3">$2</a>');
// Turn markdown links into links
record.data = record.data.replace(/(\s|^)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/[^)]*?)?)\)/, '$1<a href="$3">$2</a>');
+ // Turn *foo* into italics and **foo** into bold
+ record.data = record.data.replace(/(\s)\*\*([^*]+)\*\*(\s)/, '$1<b>$2</b>$3');
+ record.data = record.data.replace(/(\s)\*([^*]+)\*(\s)/, '$1<i>$2</i>$3');
+
// Turn refs and tags into links
record.data = record.data.replace(/(\s|^)#(\w+)/g, '$1<a href="#tag/$2">#$2</a>');
record.data = record.data.replace(/(\s|^)@(\w+)/g, '$1<a href="#$2">@$2</a>');
// Turn refs and tags into links
record.data = record.data.replace(/(\s|^)#(\w+)/g, '$1<a href="#tag/$2">#$2</a>');
record.data = record.data.replace(/(\s|^)@(\w+)/g, '$1<a href="#$2">@$2</a>');