Skip to content

Custom shortcode doesn't use codeblock padding #26

Answered by imfing
zigmd asked this question in Q&A
Discussion options

You must be logged in to vote

Need to add the wrapper around code block:

<div class="code-block relative mt-6 first:mt-0 group/code">

This can be done via either in your shortcode:

    {{ $lang := path.Ext $file | strings.TrimPrefix "." }}
    <div class="code-block relative mt-6 first:mt-0 group/code">
      {{ highlight .Content $lang }}
    </div>

or in the markdown:

<div class="code-block relative mt-6 first:mt-0 group/code">
{{< codeberg_source "https://codeberg.org/mishra/rustacean/raw/branch/main/src/getting_started/annalyns_infiltration.rs" >}}
</div>

A caveat is that this code block would not have the copy button

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@zigmd
Comment options

@imfing
Comment options

Answer selected by zigmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
styles Tweaking styles
2 participants