Support user-provided Prism syntax highlighting themes#324
Merged
Conversation
Related to #311 Tests for MPHighlightingThemeURLForNameInPaths(): - User theme takes precedence when present - Falls back to bundle theme when no user theme exists - User overrides bundle on name conflict - Falls back to default prism.css for unknown names - Handles .css extension in theme name Tests for MPListHighlightingThemesInPaths(): - Returns bundled themes - Includes user-provided themes - Deduplicates on name conflict - Ignores non-CSS files - Returns empty array when no themes exist - Returns themes sorted alphabetically Stub implementations return nil/empty to ensure tests fail (TDD). https://claude.ai/code/session_018hqL5LCNBvbJoPbMXsJoG2
Related to #311 Core changes: - Add kMPPrismThemesDirectoryName constant for "Prism/themes" path - Implement MPHighlightingThemeURLForNameInPaths() to check Application Support first, then bundle, with default fallback - Implement MPListHighlightingThemesInPaths() to merge and deduplicate themes from both sources, sorted alphabetically - Refactor MPHighlightingThemeURLForName() to delegate to the new path-parameterized function Preferences UI: - Refactor loadHighlightingThemes to use MPListHighlightingThemesInPaths - Add Reveal/Reload segmented control for Prism themes directory - Reveal creates ~/Library/Application Support/MacDown 3000/Prism/themes/ if it doesn't exist, then opens it in Finder QuickLook renderer: - Update local MPHighlightingThemeURLForName() to check Application Support before bundle resources XIB: - Add highlightingThemeFunctions segmented control next to theme dropdown - Bind enabled state to htmlSyntaxHighlighting preference https://claude.ai/code/session_018hqL5LCNBvbJoPbMXsJoG2
Contributor
Code Coverage ReportCurrent Coverage: 55.68% Coverage Details (Summary) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~/Library/Application Support/MacDown 3000/Prism/themes/Related to #311
Changes
Core Utilities (
MPUtilities.h/m)kMPPrismThemesDirectoryNameconstant ("Prism/themes")MPHighlightingThemeURLForNameInPaths()— checks user directory first, then bundle, with default fallbackMPListHighlightingThemesInPaths()— merges themes from both sources, deduplicates, sorts alphabeticallyMPHighlightingThemeURLForName()to delegate to the new path-parameterized functionPreferences UI (
MPHtmlPreferencesViewController.m/.xib)loadHighlightingThemesto useMPListHighlightingThemesInPathshighlightingThemeFunctionssegmented control with Reveal and Reload buttonsPrism/themes/directory if needed, then opens in FinderhtmlSyntaxHighlightingpreferenceQuickLook Renderer (
MPQuickLookRenderer.m)MPHighlightingThemeURLForName()to check Application Support before bundle resourcesTests (
MPUtilityTests.m)Test plan
.csstheme in~/Library/Application Support/MacDown 3000/Prism/themes/https://claude.ai/code/session_018hqL5LCNBvbJoPbMXsJoG2