Skip to content

Commit e34bf24

Browse files
phrontizoclaude
andcommitted
refactor: move highlight.min.js and hljs-themes.css to SharedResources
These files were duplicated between Markdown/Resources/ and Structured/Resources/, violating the documented SharedResources convention. Now both extensions reference a single copy via project.yml, matching the pattern used for viewer-static.min.js. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c36ddb8 commit e34bf24

8 files changed

Lines changed: 40 additions & 1298 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Draw.io diagrams referenced as `![alt](file.drawio)` are converted to `` ```draw
2828

2929
## SharedResources
3030

31-
`SharedResources/` contains resources used by multiple extension targets (currently `viewer-static.min.js` for Markdown and DrawIO). Each target references the single copy in `project.yml` — Xcode bundles it into each extension at build time. Do NOT duplicate shared resources into individual extension `Resources/` directories.
31+
`SharedResources/` contains resources used by multiple extension targets (`viewer-static.min.js` for Markdown and DrawIO; `highlight.min.js` and `hljs-themes.css` for Markdown and Structured). Each target references the single copy in `project.yml` — Xcode bundles it into each extension at build time. Do NOT duplicate shared resources into individual extension `Resources/` directories.
3232

3333
## Versioning & Releases
3434

QuickMark.xcodeproj/project.pbxproj

Lines changed: 16 additions & 20 deletions
Large diffs are not rendered by default.

Structured/Resources/highlight.min.js

Lines changed: 0 additions & 1244 deletions
This file was deleted.

Structured/Resources/hljs-themes.css

Lines changed: 0 additions & 22 deletions
This file was deleted.

project.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ targets:
7171
- path: SharedResources/viewer-static.min.js
7272
buildPhase: resources
7373
type: file
74+
- path: SharedResources/highlight.min.js
75+
buildPhase: resources
76+
type: file
77+
- path: SharedResources/hljs-themes.css
78+
buildPhase: resources
79+
type: file
7480
info:
7581
path: Markdown/Info.plist
7682
properties:
@@ -155,6 +161,12 @@ targets:
155161
- "Resources/**"
156162
- path: Structured/Resources
157163
buildPhase: resources
164+
- path: SharedResources/highlight.min.js
165+
buildPhase: resources
166+
type: file
167+
- path: SharedResources/hljs-themes.css
168+
buildPhase: resources
169+
type: file
158170
info:
159171
path: Structured/Info.plist
160172
properties:
@@ -203,6 +215,12 @@ targets:
203215
- path: SharedResources/viewer-static.min.js
204216
buildPhase: resources
205217
type: file
218+
- path: SharedResources/highlight.min.js
219+
buildPhase: resources
220+
type: file
221+
- path: SharedResources/hljs-themes.css
222+
buildPhase: resources
223+
type: file
206224
- path: Structured/PreviewViewController.swift
207225
type: file
208226
- path: Structured/Resources/structured-style.css

scripts/download-libs.sh

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ curl -sfLo "$RESOURCES_DIR/texmath.min.css" \
9393
verify_hash "$RESOURCES_DIR/texmath.min.css" "$TEXMATH_CSS_HASH" "texmath.css"
9494
echo " texmath@$TEXMATH_VER"
9595

96-
# --- highlight.js ---
97-
curl -sfLo "$RESOURCES_DIR/highlight.min.js" \
96+
# --- highlight.js (shared between Markdown and Structured extensions) ---
97+
curl -sfLo "SharedResources/highlight.min.js" \
9898
"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@$HLJS_VER/build/highlight.min.js"
99-
verify_hash "$RESOURCES_DIR/highlight.min.js" "$HLJS_HASH" "highlight.js"
99+
verify_hash "SharedResources/highlight.min.js" "$HLJS_HASH" "highlight.js"
100100
curl -sfLo "$TEMP_DIR/github.min.css" \
101101
"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@$HLJS_VER/build/styles/github.min.css"
102102
verify_hash "$TEMP_DIR/github.min.css" "$HLJS_LIGHT_HASH" "hljs-light-theme"
@@ -112,7 +112,7 @@ verify_hash "$TEMP_DIR/github-dark.min.css" "$HLJS_DARK_HASH" "hljs-dark-theme"
112112
echo "@media (prefers-color-scheme: dark) {"
113113
cat "$TEMP_DIR/github-dark.min.css"
114114
echo "}"
115-
} > "$RESOURCES_DIR/hljs-themes.css"
115+
} > "SharedResources/hljs-themes.css"
116116
echo " highlight.js@$HLJS_VER"
117117

118118
# --- KaTeX ---
@@ -147,12 +147,6 @@ curl -sfLo "SharedResources/viewer-static.min.js" \
147147
verify_hash "SharedResources/viewer-static.min.js" "$DRAWIO_VIEWER_HASH" "viewer-static.js"
148148
echo " draw.io viewer ✓"
149149

150-
# Copy highlight.js to Structured extension
151-
mkdir -p "Structured/Resources"
152-
cp "$RESOURCES_DIR/highlight.min.js" "Structured/Resources/highlight.min.js"
153-
cp "$RESOURCES_DIR/hljs-themes.css" "Structured/Resources/hljs-themes.css"
154-
echo " Copied highlight.min.js and hljs-themes.css to Structured/Resources/ ✓"
155-
156150
echo ""
157-
echo "All libraries downloaded to $RESOURCES_DIR/"
151+
echo "All libraries downloaded to $RESOURCES_DIR/ and SharedResources/"
158152
ls -lh "$RESOURCES_DIR/"

0 commit comments

Comments
 (0)