diff options
author | Chocobozzz <chocobozzz@cpy.re> | 2021-05-27 15:59:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-27 15:59:55 +0200 |
commit | 2539932e16129992a2c0889b4ff527c265a8e2c7 (patch) | |
tree | fb5048e63e02a2485eb96d27455f43e4b22e8ae0 /server/helpers/markdown.ts | |
parent | eb34ec30e0b57286fc6f85160490d2e973a3b0b1 (diff) | |
download | PeerTube-2539932e16129992a2c0889b4ff527c265a8e2c7.tar.gz PeerTube-2539932e16129992a2c0889b4ff527c265a8e2c7.tar.zst PeerTube-2539932e16129992a2c0889b4ff527c265a8e2c7.zip |
Instance homepage support (#4007)
* Prepare homepage parsers
* Add ability to update instance hompage
* Add ability to set homepage as landing page
* Add homepage preview in admin
* Dynamically update left menu for homepage
* Inject home content in homepage
* Add videos list and channel miniature custom markup
* Remove unused elements in markup service
Diffstat (limited to 'server/helpers/markdown.ts')
-rw-r--r-- | server/helpers/markdown.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/server/helpers/markdown.ts b/server/helpers/markdown.ts index 2126bb752..41e57d857 100644 --- a/server/helpers/markdown.ts +++ b/server/helpers/markdown.ts | |||
@@ -1,4 +1,6 @@ | |||
1 | import { SANITIZE_OPTIONS, TEXT_WITH_HTML_RULES } from '@shared/core-utils' | 1 | import { getSanitizeOptions, TEXT_WITH_HTML_RULES } from '@shared/core-utils' |
2 | |||
3 | const sanitizeOptions = getSanitizeOptions() | ||
2 | 4 | ||
3 | const sanitizeHtml = require('sanitize-html') | 5 | const sanitizeHtml = require('sanitize-html') |
4 | const markdownItEmoji = require('markdown-it-emoji/light') | 6 | const markdownItEmoji = require('markdown-it-emoji/light') |
@@ -18,7 +20,7 @@ const toSafeHtml = text => { | |||
18 | const html = markdownIt.render(textWithLineFeed) | 20 | const html = markdownIt.render(textWithLineFeed) |
19 | 21 | ||
20 | // Convert to safe Html | 22 | // Convert to safe Html |
21 | return sanitizeHtml(html, SANITIZE_OPTIONS) | 23 | return sanitizeHtml(html, sanitizeOptions) |
22 | } | 24 | } |
23 | 25 | ||
24 | const mdToPlainText = text => { | 26 | const mdToPlainText = text => { |
@@ -28,7 +30,7 @@ const mdToPlainText = text => { | |||
28 | const html = markdownIt.render(text) | 30 | const html = markdownIt.render(text) |
29 | 31 | ||
30 | // Convert to safe Html | 32 | // Convert to safe Html |
31 | const safeHtml = sanitizeHtml(html, SANITIZE_OPTIONS) | 33 | const safeHtml = sanitizeHtml(html, sanitizeOptions) |
32 | 34 | ||
33 | return safeHtml.replace(/<[^>]+>/g, '') | 35 | return safeHtml.replace(/<[^>]+>/g, '') |
34 | .replace(/\n$/, '') | 36 | .replace(/\n$/, '') |