Enhance description rendering in StatusPage by using marked for Markdown support
This commit is contained in:
parent
20e7beb43c
commit
216aaa239f
@ -4,6 +4,7 @@ const cheerio = require("cheerio");
|
||||
const { UptimeKumaServer } = require("../uptime-kuma-server");
|
||||
const jsesc = require("jsesc");
|
||||
const googleAnalytics = require("../google-analytics");
|
||||
const { marked } = require("marked");
|
||||
const { Feed } = require("feed");
|
||||
const config = require("../config");
|
||||
|
||||
@ -101,9 +102,10 @@ class StatusPage extends BeanModel {
|
||||
static async renderHTML(indexHTML, statusPage) {
|
||||
const $ = cheerio.load(indexHTML);
|
||||
|
||||
const rawDescription = statusPage.description ?? "";
|
||||
const descriptionText = rawDescription.replace(/<[^>]*>/g, "");
|
||||
const description155 = descriptionText.trim().substring(0, 155);
|
||||
const description155 = marked(statusPage.description ?? "")
|
||||
.replace(/<[^>]+>/gm, "")
|
||||
.trim()
|
||||
.substring(0, 155);
|
||||
|
||||
$("title").text(statusPage.title);
|
||||
$("meta[name=description]").attr("content", description155);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user