diff --git a/js/md.js b/js/md.js
index 96893a6..b1c8511 100644
--- a/js/md.js
+++ b/js/md.js
@@ -48,7 +48,7 @@ var markdown_parser = function(str){
return ''+header.trim()+'';
}],
// images
- ['/\\!\\[([^\\[]+)\\]\\(([^\\(]+)\\)/g', ''],
+// ['/\\!\\[([^\\[]+)\\]\\(([^\\(]+)\\)/g', ''],
// link
['/\\[([^\\[]+)\\]\\(([^\\(]+)\\)/g', '\\1'],
// bold
@@ -60,25 +60,25 @@ var markdown_parser = function(str){
// quote
['/\\:\\"(.*?)\\"\\:/g', '\\1
'],
// unordered list
- ['/\\n\\*(.*)/g', function(item){
- return '
';
- }],
+// ['/\\n\\*(.*)/g', function(item){
+// return '';
+// }],
// ordered list
- ['/\\n[0-9]+\\.(.*)/g', function(item){
- return '\n- '+item.trim()+'
\n
';
- }],
+// ['/\\n[0-9]+\\.(.*)/g', function(item){
+// return '\n- '+item.trim()+'
\n
';
+// }],
// blockquote
['/\\n\\>(.*)/g', function(str){
return ''+str.trim()+'
';
- }],
- // paragraphs
- ['/\\n[^\\n]+\\n/g', function(line){
- line = line.trim();
- if(line[0] === '<'){
- return line;
- }
- return '\n'+line+'
\n';
}]
+ // paragraphs
+// ['/\\n[^\\n]+\\n/g', function(line){
+// line = line.trim();
+// if(line[0] === '<'){
+// return line;
+// }
+// return '\n'+line+'
\n';
+// }]
], fixes = [
['/<\\/ul>\n/g', '\n'],
['/<\\/ol>\n/g', '\n'],
diff --git a/matrix/libqmatrixclient b/matrix/libqmatrixclient
index fe4bede..e66cae5 160000
--- a/matrix/libqmatrixclient
+++ b/matrix/libqmatrixclient
@@ -1 +1 @@
-Subproject commit fe4bedeb349ed867feba7cb3c996a97f726d2083
+Subproject commit e66cae5fd3e74c5839804e560332e5690709931a
diff --git a/qml/component/MessageBubble.qml b/qml/component/MessageBubble.qml
index ec2a67a..17c0cd1 100644
--- a/qml/component/MessageBubble.qml
+++ b/qml/component/MessageBubble.qml
@@ -25,7 +25,7 @@ AvatarContainer {
anchors.margins: 12
wrapMode: Label.Wrap
linkColor: isNotice ? Material.accent : sentByMe ? Material.accent : "white"
- textFormat: Text.StyledText
+ textFormat: contentType === "text/html" ? Text.RichText : Text.StyledText
}
}
}
diff --git a/qml/form/RoomForm.qml b/qml/form/RoomForm.qml
index dd375e4..b6be10a 100644
--- a/qml/form/RoomForm.qml
+++ b/qml/form/RoomForm.qml
@@ -195,13 +195,34 @@ Item {
var type = "m.text"
var PREFIX_ME = '/me '
+ var PREFIX_RAINBOW = '/rainbow'
if (text.indexOf(PREFIX_ME) === 0) {
text = text.substr(PREFIX_ME.length)
type = "m.emote"
}
+ if (text.indexOf(PREFIX_RAINBOW) === 0) {
+ text = text.substr(PREFIX_RAINBOW.length)
+ }
- // var parsedText = Markdown.markdown_parser(text)
- currentRoom.postMessage(type, text)
+ var result = parse(text)
+ var parsedText = result[0]
+ var isMarkdown = result [1]
+
+ if (isMarkdown) currentRoom.postHtmlMessage(text, parsedText, type)
+ else currentRoom.postMessage(type, text)
+ }
+
+ function parse(text) {
+ if (!testHTML(text)) {
+ var parsedText = Markdown.markdown_parser(text)
+ if (testHTML(parsedText)) return [parsedText, true]
+ }
+ return [text, false]
+ }
+
+ function testHTML(text) {
+ var re = new RegExp("(<([^>]+)>)")
+ return re.test(text)
}
}