Skip to content

Feature request: expand fence parameter to break code block out of readable line width #161

@aioue

Description

@aioue

Summary

Add an expand parameter to the fence line that removes the max-width constraint on that specific code block, letting it fill the full editor pane width while the rest of the note keeps its readable line width.

Use case

When Readable line length is enabled, code blocks are constrained to the same column width as prose. This is fine for short snippets but makes wide content (shell output, diffs, CSV data, long log lines) hard to read - either lines wrap awkwardly or you have to scroll a tiny horizontal strip.

A per-block opt-in keeps the default tidy while letting specific blocks breathe.

Proposed syntax

long line of output that benefits from the full pane width...

The expand token would be parsed alongside existing parameters (ln:, fold, wrap, etc.) and apply a CSS class (e.g. cbc-expanded) that overrides max-width for that block.

CSS equivalent

For reading view this is straightforward:

.cbc-expanded { max-width: 100% !important; }

Live preview would need the same StateField/decoration approach already used by the wrap feature.

Why this fits CodeblockCustomizer

You already have a full parameter parsing pipeline for the fence line. This would be a small addition to that existing system rather than a standalone plugin or CSS snippet (which can't read fence line content at all since Obsidian only exposes the first word as a language-* class).

Thanks for the great plugin!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions