From c22ebd1bff1a6bafcc9f37a463d04651007106b6 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sat, 25 Jan 2020 02:42:09 +0700 Subject: [PATCH] Format descriptions with marked library --- package.json | 1 + src/views/settings/components/Inputs.vue | 10 +++++++++- src/views/settings/components/Setting.vue | 6 +++++- yarn.lock | 5 +++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8d5cd449..876205ca 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "localforage": "^1.7.3", "lodash": "^4.17.11", "lodash.debounce": "^4.0.8", + "marked": "^0.8.0", "moment": "^2.24.0", "normalize.css": "7.0.0", "nprogress": "0.2.0", diff --git a/src/views/settings/components/Inputs.vue b/src/views/settings/components/Inputs.vue index 760d2c2c..1f5a79c6 100644 --- a/src/views/settings/components/Inputs.vue +++ b/src/views/settings/components/Inputs.vue @@ -77,7 +77,11 @@ -

{{ setting.description }}

+ @@ -86,6 +90,7 @@ import i18n from '@/lang' import { AutoLinkerInput, EditableKeywordInput, IconsInput, MascotsInput, MultipleSelect, ProxyUrlInput, PruneInput, RateLimitInput } from './inputComponents' import { processNested } from '@/store/modules/normalizers' import _ from 'lodash' +import marked from 'marked' export default { name: 'Inputs', @@ -203,6 +208,9 @@ export default { type === 'map' || (Array.isArray(type) && type.includes('keyword') && type.findIndex(el => el.includes('list') && el.includes('string')) !== -1) }, + getFormattedDescription(desc) { + return marked(desc) + }, processNestedData(value, group, parentKey, parents) { const { valueForState, valueForUpdatedSettings, diff --git a/src/views/settings/components/Setting.vue b/src/views/settings/components/Setting.vue index fb7b2252..82f8419f 100644 --- a/src/views/settings/components/Setting.vue +++ b/src/views/settings/components/Setting.vue @@ -1,7 +1,7 @@