vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

[discussion] Changing style of code blocks

Open jd-solanki opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

Hi, When I was checking my libs docs in mobile I found that in mobile there's no border-radius and code block hits the border of mobile (due to negative margin on left & right).

image

Later I found that it is intentional and VuePress is also doing the same.

However, I want to point out where it fails.

If we have indented code block then it looks like this:

image

1. Remove anu plugin use in `main.js` file if you haven't

    ```diff
    -  import { anu } from 'anu-vue'

      createApp(App)
    -   .use(anu)
        .mount('#app')
    ```

Describe the solution you'd like

  1. Remove the negative margins
  2. Remove breakpoint for adding border-radisu (apply border radius on all screens)

Describe alternatives you've considered

Revering styles:

.vp-doc div[class*='language-']:not(:where(.vp-raw *)) {
    border-radius: 8px !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
}

Additional context

This is how it looks with the new UI:

image

image

It aligns perfectly with the content ❤️

Validations

jd-solanki avatar Jul 16 '22 07:07 jd-solanki

Ah, this issue is also on https://vitepress.vuejs.org/guide/deploying.html

Later I found that it is intentional and VuePress is also doing the same.

Yeah it was to create more space. But its messing with indented code blocks.

brc-dd avatar Jul 16 '22 07:07 brc-dd

I don't necessarily consider this a bug - the style looks fine to me, and it separates indented vs. non-indented code blocks. It could be more of a personal preference.

yyx990803 avatar Mar 13 '23 08:03 yyx990803