From 9fc566e55a793289e6bd65548bab68c1710b0752 Mon Sep 17 00:00:00 2001 From: Corentin Thomasset Date: Sun, 14 Jun 2020 20:52:43 +0200 Subject: [PATCH] refactor: now using marked for changelog Signed-off-by: Corentin Thomasset --- src/routes/About.vue | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/src/routes/About.vue b/src/routes/About.vue index 511877f8..ab8ac8c9 100644 --- a/src/routes/About.vue +++ b/src/routes/About.vue @@ -11,7 +11,7 @@ - + Contributors @@ -22,12 +22,7 @@ Changelog -
-

{{section.title}}

-
    -
  • {{log}}
  • -
-
+
@@ -39,6 +34,8 @@ import Abstract from "../components/Abstract"; import GithubContributors from "../components/GithubContributors"; import changelog from "../../CHANGELOG.md" + import marked from 'marked' + import DOMPurify from 'dompurify'; export default { name: "About", @@ -46,28 +43,21 @@ changelog: [] }), mounted() { - - this.changelog = ('##' + changelog.replace(/^(.*?)##/s, '')) - .split('\n') - .filter(v => v !== '') - .reduce((sections, v) => { - v = v.trim(); - if(v.startsWith('##')){ - sections.push({ - title: v.replace(/^##/, '').trim(), - logs: [] - }) - }else { - sections.slice(-1)[0].logs.push(v.replace(/^-/, '').trim()) - } - - return sections - }, []); - console.log(this.changelog); + this.changelog = DOMPurify.sanitize(marked('##' + changelog.replace(/^(.*?)##/s, ''))); }, components: { Abstract, GithubContributors }, } - \ No newline at end of file + + + \ No newline at end of file