Skip to content

Commit 6114079

Browse files
committed
Add markdown-preview plugin
1 parent 10c54f4 commit 6114079

File tree

5 files changed

+710
-0
lines changed

5 files changed

+710
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Markdown Preview Plugin
2+
3+
Add a plugin to Elementary Code that allows users to preview rendered markdown in a side-by-side view alongside the editor.
4+
5+
## User Review Required
6+
7+
> [!IMPORTANT]
8+
> **Rendering Approach**: This plugin will use WebKit (webkit2gtk-4.0) to render the markdown as HTML. The preview will appear in a separate pane that can be toggled on/off. The markdown will be converted to HTML and styled with GitHub-flavored markdown CSS for a clean, familiar appearance.
9+
10+
> [!IMPORTANT]
11+
> **UI Integration**: The preview will be accessible via:
12+
> - A toolbar button that appears when editing markdown files
13+
> - A keyboard shortcut (Ctrl+Shift+M)
14+
> - The preview pane will appear to the right of the editor in a split view
15+
16+
## Proposed Changes
17+
18+
### Markdown Preview Plugin
19+
20+
A new plugin that provides live markdown rendering capabilities for markdown files.
21+
22+
#### [NEW] [markdown-preview.vala](file:///home/chuck/Dropbox/Programming/Languages_and_Code/Programming_Projects/Programming_Tools/elementary-code-altdistros/plugins/markdown-preview/markdown-preview.vala)
23+
24+
Main plugin implementation with:
25+
- WebKit WebView for rendering HTML
26+
- Markdown to HTML conversion using a simple parser
27+
- Live preview updates as the user types (with debouncing)
28+
- Split pane integration with the editor
29+
- Toggle button in toolbar for showing/hiding preview
30+
- Keyboard shortcut (Ctrl+Shift+M) support
31+
- Auto-scroll synchronization between editor and preview
32+
- GitHub-flavored markdown CSS styling
33+
34+
#### [NEW] [markdown-preview.plugin](file:///home/chuck/Dropbox/Programming/Languages_and_Code/Programming_Projects/Programming_Tools/elementary-code-altdistros/plugins/markdown-preview/markdown-preview.plugin)
35+
36+
Plugin metadata file describing the plugin name, description, and author information.
37+
38+
#### [NEW] [meson.build](file:///home/chuck/Dropbox/Programming/Languages_and_Code/Programming_Projects/Programming_Tools/elementary-code-altdistros/plugins/markdown-preview/meson.build)
39+
40+
Build configuration for the markdown-preview plugin, including webkit2gtk-4.0 dependency.
41+
42+
---
43+
44+
### Plugin Registration
45+
46+
#### [MODIFY] [meson.build](file:///home/chuck/Dropbox/Programming/Languages_and_Code/Programming_Projects/Programming_Tools/elementary-code-altdistros/plugins/meson.build)
47+
48+
Add `subdir('markdown-preview')` to register the new plugin in the build system.
49+
50+
## Verification Plan
51+
52+
### Automated Tests
53+
- Build the project with `meson setup build --prefix=/usr && ninja -C build`
54+
- Verify no compilation errors
55+
- Check that the plugin is installed to the correct directory
56+
57+
### Manual Verification
58+
- Launch Elementary Code
59+
- Open a markdown file ([.md](file:///home/chuck/.gemini/antigravity/brain/b88974f6-b6d8-4497-a368-2ef66eb65ce1/task.md) extension)
60+
- Verify the preview toggle button appears in the toolbar
61+
- Click the button or press Ctrl+Shift+M to show the preview pane
62+
- Verify markdown is rendered correctly with:
63+
- Headers (H1-H6)
64+
- Bold and italic text
65+
- Lists (ordered and unordered)
66+
- Code blocks with syntax highlighting
67+
- Links
68+
- Images
69+
- Blockquotes
70+
- Tables
71+
- Edit the markdown and verify the preview updates in real-time
72+
- Verify the preview can be toggled on/off
73+
- Test with non-markdown files to ensure the button doesn't appear
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Plugin]
2+
Module=markdown-preview
3+
Loader=C
4+
IAge=2
5+
Name=Markdown Preview
6+
Description=Live preview of rendered Markdown files in a side-by-side view
7+
Icon=view-paged-symbolic
8+
Authors=Elementary Code Contributors
9+
Copyright=Copyright © 2026 Elementary Code Contributors
10+
Hidden=false

0 commit comments

Comments
 (0)