notice: collapse borders if single code block is displayed #906

This commit is contained in:
Sören Weber 2024-09-04 19:48:14 +02:00
parent 649600bae8
commit 0edaa81974
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
3 changed files with 42 additions and 0 deletions

View file

@ -18,6 +18,12 @@ This document shows you what's new in the latest release and flags it with one o
--- ---
## 6.4.0.beta (XXXX-XX-XX) {#640}
- {{% badge style="note" title=" " %}}Change{{% /badge %}} If you now display a single code block in a `notice` box, its [margin and border will be removed](shortcodes/notice#code-with-collapsed-colored-borders) so only the colored notice border is visible.
---
## 6.3.0 (2024-09-03) {#630} ## 6.3.0 (2024-09-03) {#630}
- {{% badge style="note" title=" " %}}Change{{% /badge %}} The [`expand` shortcode](shortcodes/expand) changed the naming of the `open` parameter to `expanded`. You don't need to change anything yet but may get deprecation warnings. - {{% badge style="note" title=" " %}}Change{{% /badge %}} The [`expand` shortcode](shortcodes/expand) changed the naming of the `open` parameter to `expanded`. You don't need to change anything yet but may get deprecation warnings.

View file

@ -309,3 +309,31 @@ Just a box
> [!info] Can callouts be nested? > [!info] Can callouts be nested?
> > [!important] Yes!, they can. > > [!important] Yes!, they can.
> > > [!tip] You can even use multiple layers of nesting. > > > [!tip] You can even use multiple layers of nesting.
#### Code with Collapsed Colored Borders
````
```c
// Normal code:
printf( "Hello world\n" )
```
{{%/* notice style="red" title="" */%}}
```c
// With colored border
printf( "Hello world\n" )
```
{{%/* /notice */%}}
````
```c
// Normal code:
printf( "Hello world\n" )
```
{{% notice style="red" title="" %}}
```c
// With colored border
printf( "Hello world\n" )
```
{{% /notice %}}

View file

@ -721,6 +721,14 @@ div.box > .box-content {
padding-left: 1rem; padding-left: 1rem;
padding-right: 1rem; padding-right: 1rem;
} }
/* remove margin if only a single code block is contained in the tab */
#R-body .box-content:has(> div.highlight:only-child){
padding: 0;
}
/* remove border from a code block if single */
#R-body .box-content > div.highlight:only-child > pre{
border: 0;
}
p:empty { p:empty {
/* in case of image render hook, Hugo may generate empty <p>s that we want to ignore */ /* in case of image render hook, Hugo may generate empty <p>s that we want to ignore */