This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Markdown Shell Extensions is a Delphi project providing Windows shell integration for markdown files:
- MDShellExtensions.dll (32/64-bit) - Windows shell extension library providing Preview Handler and Thumbnail Provider for markdown files in Windows Explorer
- MDTextEditor.exe - Standalone markdown text editor with live HTML preview
- Delphi 12 or 13 (RAD Studio)
- Inno Setup 6 (for installer)
Open Source\MDShellExtensionsGroup.groupproj which contains:
MDShellExtensions32.dproj- 32-bit shell extension DLLMDShellExtensions.dproj- 64-bit shell extension DLLMDTextEditor.dproj- Markdown editor application
# Set up Delphi environment (adjust path to your installation)
call "C:\BDS\Studio\37.0\bin\rsvars.bat"
# Build individual projects
msbuild.exe "Source\MDShellExtensions.dproj" /target:Clean;Build /p:Platform=Win64 /p:config=release
msbuild.exe "Source\MDShellExtensions32.dproj" /target:Clean;Build /p:Platform=Win32 /p:config=release
msbuild.exe "Source\MDTextEditor.dproj" /target:Clean;Build /p:Platform=Win64 /p:config=release
msbuild.exe "Source\MDTextEditor.dproj" /target:Clean;Build /p:Platform=Win32 /p:config=release# Register 32-bit DLL
%systemroot%\SysWoW64\regsvr32 "Bin32\MDShellExtensions32.dll"
# Register 64-bit DLL
%systemroot%\System32\regsvr32 "Bin64\MDShellExtensions.dll"
# Unregister uses same commands with /u flagImportant: Close all Windows Explorer instances before registering/unregistering as the DLL stays loaded in memory.
"C:\Program Files (x86)\Inno Setup 6\iscc.exe" "Setup\MDShellExtensions.iss"Shell Extension DLL (MDShellExtensions.dpr):
MDShellEx.PreviewHandler- Implements Windows Preview Handler (IPreviewHandler) for Explorer preview paneMDShellEx.ThumbnailHandler- Implements thumbnail provider (IThumbnailProvider) for file iconsMDShellEx.ContextMenuHandler- Right-click context menu integrationMDShellEx.PreviewForm- VCL form rendered in Explorer preview pane- Uses GUIDs for 32-bit and 64-bit variants (defined in
MDShellEx.PreviewHandler.pas)
Editor Application (MDTextEditor.dpr):
MDTextEditor.EditorMainForm- Main editor form with tabbed interfaceMDShellEx.Settings- User preferences and theme managementMDShellEx.Resources- Shared resources (images, icons)
- MarkdownProcessor - Markdown to HTML conversion
- HTMLViewer - HTML rendering component
- SynEdit - Syntax highlighting editor
- SVGIconImageList - SVG icon support
- StyledComponents - VCL styled components
- Skia4Delphi - Image format support (webp, wbmp)
- Image32 - SVG rendering
Defined in MDShellEx.Misc.pas:
.md, .mkd, .mdwn, .mdown, .mdtxt, .mdtext, .markdown
Bin32\- 32-bit binariesBin64\- 64-bit binariesSetup\Output\- Installer output
The application supports Windows light/dark themes. Theme selection is managed via TThemeSelection enum in MDShellEx.Settings.pas:
tsAsWindows- Follow Windows themetsDarkTheme- Force dark themetsLightTheme- Force light theme
TfrmMain - Main application form implementing:
IDragDropinterface for file drag-and-drop support- Tabbed document interface via
TPageControlEx - Split view with collapsible menu (
TSplitView) - Markdown toolbar with formatting buttons (
TStyledToolbar)
TEditingFile - Class representing each open document:
SynEditor: TSynEdit- Syntax highlighted markdown editorHTMLViewer: THTMLViewer- Live HTML preview panelFMarkDownFile: TMarkDownFile- Parsed markdown content (from MarkdownProcessor)TabSheet: TTabSheet- Tab in the PageControlSplitter: TSplitter- Resizable splitter between editor and preview- Key methods:
ReadFromFile,SaveToFile,ShowMarkDownAsHTML,UpdateRootPath
File Operations (ActionList):
acNewFile,acOpenFile,acSave,acSaveAs,acSaveAllacClose,acCloseAll,acQuitOpenRecentAction- Recent files menuacSaveHTMLFile,acSavePDFFile- Export functionality
Edit Operations:
acEditCut,acEditCopy,acEditPaste,acEditSelectAll,acEditUndoacSearch,acReplace,acSearchAgainacZoomIn,acZoomOut,acRefresh
Markdown Toolbar Actions (ToolbarActionList):
- Headers:
acHeader1,acHeader2,acHeader3 - Links/Media:
acLink,acImage,acTable - Text Formatting:
acBold,acItalic,acStrike,acUnderline,acCode,acMarker - Subscript/Superscript:
acSubscript,acSuperscript - Lists:
acUnorderedList,acOrderedList - Blocks:
acBlockquote,acHorizontalRule
Layout Modes (TLayoutMode in Settings):
lmBoth- Show both editor and HTML preview side-by-sidelmMarkDown- Show only markdown editorlmHTML- Show only HTML preview- Actions:
acLayoutBoth,acLayoutMarkDown,acLayoutViewer
Print/Export:
actnPrint,actnPrintPreview,actnPrinterSetup,actnPageSetup- PDF export via
vmHtmlToPdf.pas(uses SynPDF + HTMLViewer)
TSettings (base class):
- Font settings:
MDFontName,MDFontSize,HTMLFontName,HTMLFontSize - Theme:
StyleName,ThemeSelection,UseDarkStyle - Layout:
SplitterPos,LayoutMode,ViewerPercentSize - Markdown dialect:
ProcessorDialect(TMarkdownProcessorDialect) - UI options:
ButtonDrawRounded,ToolbarDrawRounded,MenuDrawRounded - PDF page settings:
PDFPageSettingsrecord - Settings stored in INI file format
TEditorSettings (extends TSettings):
HistoryFileList- Recently opened filesOpenedFileList- Files open at last session (restored on startup)CurrentFileName- Active fileDownloadFromWEB- Allow loading remote imagesAutoRefreshWhenEditing- Real-time preview updatesLightActiveLineColor,DarkActiveLineColor- Editor active line colors- SynEdit options: Gutter, RightEdge, LineSpacing, Bookmarks, WordWrap
TPreviewSettings (for shell extension preview):
- Lighter configuration for Explorer preview pane
- Settings stored in
%APPDATA%\MDShellExtensions\PreviewSettings.ini
- TSynEdit - Markdown text editor with syntax highlighting
- THTMLViewer - HTML rendering for preview (supports local file links, images)
- TPageControlEx - Extended PageControl with close buttons on tabs (
PageControlHook.pas) - TStyledToolbar/TStyledButton - Themed toolbar buttons (from StyledComponents)
- TSplitView - Collapsible side menu panel
- TStyledCategoryButtons - Menu items in split view
- User edits markdown in
SynEditor SynEditChangeevent triggersUpdateMDViewerTEditingFile.ShowMarkDownAsHTMLconverts markdown to HTML viaTMarkDownFile- HTML rendered in
THTMLViewercomponent - Clicking links in preview:
HtmlViewerHotSpotClickhandles navigation/file opening
Editor settings location (in order of precedence):
- Same folder as executable:
MDTextEditor.ini - AppData:
%APPDATA%\MDShellExtensions\EditorSettings.ini
Preview handler settings:
%APPDATA%\MDShellExtensions\PreviewSettings.ini