Skip to content

Commit

Permalink
feat: render popertylist description as markdown (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys authored May 30, 2022
1 parent b61b375 commit 33ea5c3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
12 changes: 12 additions & 0 deletions exampleSite/data/properties/demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions layouts/shortcodes/propertylist.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@
{{- end }}
</dt>
<dd>
<div>
<div class="gdoc-props__description">
{{- with $value.description }}
{{- $desc := . }}
{{- if reflect.IsMap $desc }}
{{- $desc = (index $desc $.Site.Language.Lang) }}
{{- end }}

{{ $desc }}
{{ $desc | $.Page.RenderString }}
{{ end }}
</div>
<div class="gdoc-props__default">
{{- with default "none" $value.defaultValue }}
{{- with default "none" ($value.defaultValue | string) }}
<span>{{ i18n "propertylist_default" | title }}:</span>
<span>{{ . }}</span>
{{- end }}
Expand Down
14 changes: 11 additions & 3 deletions src/sass/_shortcodes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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%);
Expand All @@ -218,7 +227,6 @@
}

&__default {
font-style: italic;
font-size: $font-size-14;
}
}

0 comments on commit 33ea5c3

Please sign in to comment.