Skip to content

CodeBlocks

MeanderingProgrammer edited this page Oct 13, 2024 · 7 revisions

Code Blocks

Raw data being used:

# Code Blocks

```python
def main() -> None:
    print("Hello, World!")
```

```rust
fn main() {
    println!("Hello, World!");
}
```

Default

require('render-markdown').setup({
    code = {
        enabled = true,
        sign = true,
        style = 'full',
        position = 'left',
        language_pad = 0,
        language_name = true,
        disable_background = { 'diff' },
        width = 'full',
        left_margin = 0,
        left_pad = 0,
        right_pad = 0,
        min_width = 0,
        border = 'thin',
        above = '',
        below = '',
        highlight = 'RenderMarkdownCode',
        highlight_inline = 'RenderMarkdownCodeInline',
        highlight_language = nil,
    },
})

Disable Sign

require('render-markdown').setup({
    code = { sign = false },
})

Style Normal

require('render-markdown').setup({
    code = { style = 'normal' },
})

Style Language

require('render-markdown').setup({
    code = { sign = 'language' },
})

Width Block Padding

require('render-markdown').setup({
    code = {
        width = 'block',
        left_pad = 2,
        right_pad = 4,
    },
})

Width Block Min Width

require('render-markdown').setup({
    code = {
        width = 'block',
        min_width = 45,
    },
})

Width Block Min Width Left Padding

require('render-markdown').setup({
    code = {
        width = 'block',
        min_width = 45,
        left_pad = 2,
        language_pad = 2,
    },
})

Width Block Center

require('render-markdown').setup({
    code = {
        width = 'block',
        left_margin = 0.5,
        left_pad = 0.2,
        right_pad = 0.2,
    },
})

Position Right

require('render-markdown').setup({
    code = {
        position = 'right',
        width = 'block',
        right_pad = 10,
    },
})

Border Thick

require('render-markdown').setup({
    code = {
        style = 'normal',
        border = 'thick',
    },
})
Clone this wiki locally