feat: make url clickable (#14353)
This commit is contained in:
@@ -4,6 +4,8 @@ const cheerio = require('cheerio');
|
||||
const dayjs = require('dayjs');
|
||||
const { constructTopicEntry } = require('@/v2/jike/utils');
|
||||
|
||||
const urlRegex = /(https?:\/\/[^\s"'<>]+)/g;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const topicUrl = `https://m.okjike.com/topics/${id}`;
|
||||
@@ -33,6 +35,7 @@ module.exports = async (ctx) => {
|
||||
return description;
|
||||
});
|
||||
}
|
||||
item.description = item.description.replaceAll(urlRegex, (url) => `<a href="${url}">${url}</a>`);
|
||||
item.title = `${data.topic.content} ${dayjs(one.pubDate).format('MM月DD日')}`;
|
||||
return item;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user