Skip to content

Add toolbar buttons for reading mode and live preview - #2

Open
Art-Porto wants to merge 1 commit into
rsalinger:mainfrom
Art-Porto:markdown-toolbar-buttons
Open

Art-Porto wants to merge 1 commit into
rsalinger:mainfrom
Art-Porto:markdown-toolbar-buttons

Conversation

@Art-Porto

@Art-Porto Art-Porto commented Nov 9, 2026 •

Copy link
Copy Markdown

Summary

  • Add separate toolbar buttons for Toggle Reading Mode and Toggle Preview Panel, using the existing commands.
  • Give each button a distinct Markdown-themed icon with light and dark variants.
  • Keep the two toggles independent so either mode can be used alone or both can be active together.
  • Double-clicking a paragraph in reading mode no longer turns it off. Reading mode now only turns off from its toggle (menu, toolbar button or shortcut). The double-click moves the source caret to that line, so toggling off lands on that paragraph. In the preview panel, double-click still jumps to the source line.
  • Refresh reading mode after a file is reloaded from disk. Reloading detaches the editor from its document, so no SCN_MODIFIED reaches the plugin; the reading view now renders again when Notepad++ re-activates the buffer, instead of showing the old text until another tab is selected.

Testing

  • Built the x64 plugin and loaded it in Notepad++ 8.9.8.1.
  • Verified registration and checked-state transitions for both buttons, including enabling both and turning either one off independently.
  • Rebuilt x64 Release and ran the native test suite. All 17 tests passed.
  • In a portable Notepad++ 8.9.8.1 x64: changed an open Markdown file on disk and reloaded it while in reading mode. Before the fix the reading view kept the old text; with it, the new text shows right away. Double-clicking a paragraph keeps reading mode on and moves the caret to that line.

Screenshots

Captured in Notepad++ 8.9.8.1 (x64) with the build from this PR and a sample Markdown file.

Reading mode

Click the blue book to render Markdown in the editor area. Click it again to return to the source.

Reading mode renders the Markdown document in the editor area with the blue book button active.

Side preview

Click the green window to show the live preview next to the editable Markdown source.

The Markdown source is visible on the left and the rendered live preview is docked on the right.

Both modes active

Both buttons can be active together. Turning off Reading Mode returns the left pane to the source while the side preview stays open.

The reading view is open on the left and the docked preview is open on the right, with both toolbar buttons active.

@Art-Porto
Art-Porto force-pushed the markdown-toolbar-buttons branch from 1e59610 to 4b4becf Compare November 14, 2026 21:18
Reading mode now only turns off from its toggle (menu, toolbar button or
shortcut). Double-clicking a paragraph in reading mode moves the hidden
editor's caret to that line without scrolling, so toggling off lands on
the paragraph. The preview panel keeps jumping to the source.

Reading mode also refreshes after a file is reloaded from disk. Reloading
detaches the editor from its document, so no SCN_MODIFIED reaches the
plugin, and Notepad++ only re-activates the buffer afterwards. A reading
view that kept the same document now renders again on that activation
instead of showing the old text until another tab is selected.
@Art-Porto
Art-Porto force-pushed the markdown-toolbar-buttons branch from 4b4becf to 81b51f4 Compare November 15, 2026 22:30
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.

1 participant