Skip to content

Commit a824b2a

Browse files
authored
Shortcode 'card': trimming of whitespace (#2278)
1 parent 614e7ec commit a824b2a

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

assets/scss/shortcodes/cards-pane.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
pre {
2626
margin: 0;
27-
padding: 0 1rem 1rem 1rem;
2827
}
2928
}
3029
}

layouts/_shortcodes/card.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ <h6 class="card-title ms-2 text-body-secondary">
3131
{{ end -}}
3232
{{ with $.Inner -}}
3333
{{ if $code -}}
34-
{{ highlight . $lang $highlight -}}
34+
{{ highlight ( . | strings.TrimSpace ) $lang $highlight -}}
3535
{{ else -}}
3636
<p class="card-text">
3737
{{ . -}}

userguide/content/en/docs/adding-content/shortcodes/index.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,10 +669,18 @@ int main(void)
669669

670670
This code translates to the card shown below:
671671

672-
{{< card code=true header="**C**" lang="C" highlight="" >}} #include <stdio.h>
672+
<!-- prettier-ignore-start -->
673+
{{< card code=true header="**C**" lang="C" highlight="" >}}
674+
#include <stdio.h>
673675
#include <stdlib.h>
674676

675-
int main(void) { puts("Hello World!"); return EXIT_SUCCESS; } {{< /card >}}
677+
int main(void)
678+
{
679+
puts("Hello World!");
680+
return EXIT_SUCCESS;
681+
}
682+
{{< /card >}}
683+
<!-- prettier-ignore-end -->
676684

677685
<br/>If called with parameter `code=true`, the `card` shortcode can optionally
678686
hold the named parameters `lang` and/or `highlight`. The values of these

0 commit comments

Comments
 (0)