一键导入
setup
// Get a new developer up and running with the Clearly codebase — prerequisites, build, and architecture orientation.
// Get a new developer up and running with the Clearly codebase — prerequisites, build, and architecture orientation.
| name | setup |
| description | Get a new developer up and running with the Clearly codebase — prerequisites, build, and architecture orientation. |
Set up the Clearly development environment and orient a new contributor to the codebase.
Verify these are installed. If any are missing, tell the user what to install and stop.
sw_vers -productVersion (must be >= 14.0)xcode-select -p (if missing: xcode-select --install)which brew (if missing: direct them to https://brew.sh)which xcodegen (if missing: brew install xcodegen)If .env does not exist in the project root:
.env.example to .env and fill in their Apple Developer credentialsxcodegen generate
This reads project.yml (the source of truth for all Xcode project settings) and generates Clearly.xcodeproj. Re-run this anytime project.yml changes. Never edit the .xcodeproj directly.
xcodebuild -scheme Clearly -configuration Debug build
Or open in Xcode and hit Cmd+R:
open Clearly.xcodeproj
Share this architecture overview:
Two targets defined in project.yml:
Shared code in Shared/:
MarkdownRenderer.swift — wraps cmark_gfm_markdown_to_html() for GFM renderingPreviewCSS.swift — CSS string used by both the in-app preview and QuickLook extensionApp code in Clearly/:
ClearlyApp.swift — App entry point, DocumentGroup with MarkdownDocument, menu commandsContentView.swift — Mode picker toolbar, switches between EditorView and PreviewViewEditorView.swift — NSViewRepresentable wrapping NSTextView with undo, find panel, and live syntax highlightingMarkdownSyntaxHighlighter.swift — Regex-based syntax highlighter applied to NSTextStoragePreviewView.swift — NSViewRepresentable wrapping WKWebView for rendered previewTheme.swift — Centralized colors (dynamic light/dark) and font/spacing constantsKey design decisions:
NSTextView bridged to SwiftUI, not SwiftUI's TextEditor — this provides undo, find panel, and NSTextStorageDelegate-based highlightingTheme with dynamic light/dark resolution — don't hardcode colorsPreviewCSS.swift must stay in sync with Theme colorsproject.yml is the source of truth for Xcode settings — never edit .xcodeproj directly