markdown linkuser 小修复

This commit is contained in:
alsotang 2014-11-19 19:30:24 +08:00
parent 7d027ea264
commit afff071e89
3 changed files with 13 additions and 1 deletions

View File

@ -21,7 +21,7 @@ var _ = require('lodash');
*/
var fetchUsers = function (text) {
var ignore_regexs = [
/```.+?```/, // 去除单行的 ```
/```.+?```/g, // 去除单行的 ```
/^```[\s\S]+?^```/gm, // ``` 里面的是 pre 标签内容
/`[\s\S]+?`/g, // 同一行中,`some code` 中内容也不该被解析
/^ .*/gm, // 4个空格也是 pre 标签,在这里 . 不会匹配换行
@ -33,6 +33,7 @@ var fetchUsers = function (text) {
text = text.replace(ignore_regex, '');
});
var results = text.match(/@[a-z0-9\-_]+\b/igm);
var names = [];
if (results) {

View File

@ -19,6 +19,9 @@ var renderHelper = require('../common/render_helper');
// 主页的缓存工作。主页是需要主动缓存的
function indexCache() {
if (config.debug) {
return;
}
var limit = config.list_topic_count;
// 为所有版块tab做缓存
[['', '全部']].concat(config.tabs).forEach(function (pair) {

View File

@ -44,6 +44,10 @@ describe('test/common/at.test.js', function () {
@alsotang3
```
```js
@flow
```
```@alsotang4```
@
@ -87,6 +91,10 @@ jysperm@gmail.com [@alsotang](/user/alsotang)
@alsotang3
```
```js
@flow
```
```@alsotang4```
@