Skip to content

[Enhancement] Improve pilcrow styling#6152

Merged
nathanlesage merged 11 commits into
Zettlr:developfrom
benniekiss:pilcrow-improve
Feb 7, 2026
Merged

[Enhancement] Improve pilcrow styling#6152
nathanlesage merged 11 commits into
Zettlr:developfrom
benniekiss:pilcrow-improve

Conversation

@benniekiss

@benniekiss benniekiss commented Jan 26, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR includes several pilcrow improvements, including no longer drawing them on code-block marker lines (```) and no longer triggering line wrapping,

Changes

Pilcrows are no longer drawn on lines for code block or pandoc div formatting marks, i.e. ``` and :::. This was discussed in #6067

Additionally, pilcrows are no longer drawn on folded lines. This prevents two pilcrows from showing up on a line when a range is folded.

Pilcrows no longer trigger wrapping to the next line. This prevents the pilcrow from wrapping by itself, ending up on the line alone. Because pilcrows may now overflow the text boundary, the cm-content { overflow-x } CSS property was changed from hidden to visible.

The header styling was changed so that the styling is applied to the whole line. When I migrated the code to these CSS styles, I did not realize the selecter I used, .cm-header-*, is only applied to small runs of characters within the header, not the entire line, so some characters within a header may not receive the styling. I noticed this because pilcrows and trailing space did not.

Additional information

Linewrapping and header styling:

CURRENT:

Screen.Recording.2026-01-26.at.09.43.49.mov

PR:

Screen.Recording.2026-01-26.at.09.43.17.mov

Tested on: macOS 26

@nathanlesage nathanlesage left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit wary with regard to the overflow, did you test this extensively? I am a bit afraid this could mess with CodeMirror's line wrapping calculation, or am I just over-cautious here?

Comment thread source/win-main/MainEditor.vue Outdated
@benniekiss

Copy link
Copy Markdown
Collaborator Author

I'm a bit wary with regard to the overflow, did you test this extensively? I am a bit afraid this could mess with CodeMirror's line wrapping calculation, or am I just over-cautious here?

I'll be testing this over the next couple days, so I'm fine letting it sit until I can report back. But have not had any issues so far. Text wrapping is normal, and from my understanding, visible and hidden are essentially the same, except for how the overflowing content is displayed

@nathanlesage

Copy link
Copy Markdown
Member

Okay, sounds good! First thing on my todo today is releasing 4.1.1 and then trying to convince Azure to use a new code cert, when that works I'll be less stressed as well 🙈

@benniekiss

Copy link
Copy Markdown
Collaborator Author

Last two commits handle two issues I was seeing:

The line wrapping plugin was calculating in indent in narrow windows that shouldn't be there, and the issue was with the whitespace regex, which was matching on zero or more whitespace. I corrected it to require at least one whitespace character. Have not noticed any indent issues otherwise.

Wide tables were causing the content window to scroll. Adding back overflow-x: hidden fixed the problem, but I believe the scrolling was happening because the .cm-content element had min-width: 100%; set. Unsetting it to min-width: 0 allows the content window to shrink enough to prevent scrolling.

Otherwise, haven't seen any other problems working the past two days

* when selecting the beginning of a line of text
* to the beginning of a following blank line,
* then press a character to replace the text, literal
* pilcrow text is added to the end of the line.
* setting `user-select: none` and `pointer-events: none`
* seems to solve this

@nathanlesage nathanlesage left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found two more minor things, but this thing looks mergeable!

Comment thread source/common/modules/markdown-editor/plugins/highlight-whitespace.ts Outdated
Comment thread source/common/vue/CodeEditor.vue
@nathanlesage

Copy link
Copy Markdown
Member

Trés bien, and merging!

@nathanlesage nathanlesage merged commit e24dfae into Zettlr:develop Feb 7, 2026
1 check passed
@benniekiss benniekiss deleted the pilcrow-improve branch February 7, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants