From 33ea5c37a9d6ac063a77071db9c50cfdef3f97ba Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 30 May 2022 21:40:09 +0200 Subject: [PATCH] feat: render popertylist description as markdown (#426) --- exampleSite/data/properties/demo.yaml | 12 ++++++++++++ layouts/shortcodes/propertylist.html | 6 +++--- src/sass/_shortcodes.scss | 14 +++++++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/exampleSite/data/properties/demo.yaml b/exampleSite/data/properties/demo.yaml index c1f8fe9..b220b00 100644 --- a/exampleSite/data/properties/demo.yaml +++ b/exampleSite/data/properties/demo.yaml @@ -15,3 +15,15 @@ properties: en: - tag1 - tag2 + + prop3: + type: bool + defaultValue: false + description: | + A `bool` property with a complex multiline description and embedded Markdown: + + - List item 1 + - List item 2 + + More description how to use this property. + required: false diff --git a/layouts/shortcodes/propertylist.html b/layouts/shortcodes/propertylist.html index e592f82..eddae6d 100644 --- a/layouts/shortcodes/propertylist.html +++ b/layouts/shortcodes/propertylist.html @@ -26,18 +26,18 @@ {{- end }}
-
+
{{- with $value.description }} {{- $desc := . }} {{- if reflect.IsMap $desc }} {{- $desc = (index $desc $.Site.Language.Lang) }} {{- end }} - {{ $desc }} + {{ $desc | $.Page.RenderString }} {{ end }}
- {{- with default "none" $value.defaultValue }} + {{- with default "none" ($value.defaultValue | string) }} {{ i18n "propertylist_default" | title }}: {{ . }} {{- end }} diff --git a/src/sass/_shortcodes.scss b/src/sass/_shortcodes.scss index 8fa7484..0727ac9 100644 --- a/src/sass/_shortcodes.scss +++ b/src/sass/_shortcodes.scss @@ -191,15 +191,24 @@ &__meta { line-height: normal; - margin-bottom: $padding-8; + margin-bottom: $padding-4; > span { - margin-bottom: $padding-4; + margin-bottom: $padding-2; &:not(:last-child) { margin-right: $padding-8; } } } + &__description { + > :first-child { + margin-top: 0; + } + > :last-child { + margin-bottom: 0; + } + } + @each $name, $color in $hint-colors { &__tag.#{$name} { border-color: scale-color($color, $lightness: 90%, $saturation: -30%); @@ -218,7 +227,6 @@ } &__default { - font-style: italic; font-size: $font-size-14; } }