Pārlūkot izejas kodu

support markdown-like emphasis.

Lucas Stadler 11 gadi atpakaļ
vecāks
revīzija
12a94dbba7
1 mainītis faili ar 9 papildinājumiem un 0 dzēšanām
  1. 9 0
      js/babl/public/index.html

+ 9 - 0
js/babl/public/index.html

@ -73,6 +73,15 @@
73 73
					el.textContent = match[0];
74 74
					return el;
75 75
				}
76
			}, {
77
				re: /^(\*\*?|__?)([^\s]+)\1$/,
78
				fn: function(match) {
79
					var highlight = {"*": "em", "**": "strong", "_": "em", "__": "strong"};
80
					console.log(match.toString());
81
					var el = document.createElement(highlight[match[1]]);
82
					el.textContent = match[2];
83
					return el;
84
				}
76 85
			}, { re: /.*/, fn: function(match) { return new Text(match[0]); }}];
77 86
78 87
			function expandWord(word) {