Browse Source

Replace @username with link to username

sbkwgh 8 years ago
parent
commit
d06fe0ce22
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/components/InputEditorPreview.vue

+ 5 - 1
src/components/InputEditorPreview.vue

@@ -22,7 +22,11 @@
 		props: ['value'],
 		computed: {
 			HTML () {
-				return Marked(this.value);
+				let replacedMd = this.value.replace(/@[^\s]+/g, match => {
+					return `[${match}](/user/${match.slice(1)})`
+				})
+
+				return Marked(replacedMd);
 			}
 		}
 	}