Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ jobs:
echo "warnings: $(grep -cE '^/.*:[0-9]+:[0-9]+: warning:' build/xcodebuild-build.log || true)"
exit $status

# MarkdownView builds its LaTeX support, and links SwiftMath, only when
# its `LaTeX` trait is on. Without it the app still builds and every
# formula shows up as raw `$$…$$` source, so check for both here.
- name: Check LaTeX rendering is compiled in
run: |
status=0
if ! grep -q 'ENABLE_MATH_RENDERING' build/xcodebuild-build.log; then
echo "::error::MarkdownView was built without ENABLE_MATH_RENDERING, so formulas would show as raw LaTeX"
status=1
fi
if ! ls build/DerivedData/Build/Products/Debug/ClassNote.app/Contents/Resources | grep -q SwiftMath; then
echo "::error::SwiftMath's resources are missing from ClassNote.app"
status=1
fi
exit $status

- name: Run unit + integration tests
run: |
set +e
Expand Down
2 changes: 1 addition & 1 deletion Core/Utils/RichMarkdownView.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SwiftUI
import MarkdownView
import MarkdownRendering

/// Every piece of Markdown the app shows (notes, Q&A, study tools, highlight
/// explanations, live tutor cards), rendered by the MarkdownView package:
Expand Down
6 changes: 6 additions & 0 deletions Core/Utils/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ extension View {
modifier(CardBackground(radius: radius, filled: filled))
}
func pill(_ color: Color) -> some View { modifier(PillStyle(color: color)) }

/// A list of choices inside a page (study tools, highlights, note
/// versions). The sidebar style brings the window sidebar's translucent
/// material with it, which inside a page shows the desktop through a hole
/// in the window; the inset style draws an opaque background.
func paneListStyle() -> some View { listStyle(.inset) }
}

/// A titled group on a settings-style page.
Expand Down
2 changes: 1 addition & 1 deletion Features/Session/HighlightsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct HighlightsView: View {
}
}
}
.listStyle(.sidebar)
.paneListStyle()
.frame(width: 240)
Divider()
HighlightDetail(vm: vm)
Expand Down
2 changes: 1 addition & 1 deletion Features/Session/NotesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,6 @@ struct NotesView: View {
}
.buttonStyle(.plain)
}
.listStyle(.sidebar)
.paneListStyle()
}
}
2 changes: 1 addition & 1 deletion Features/Session/StudyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ struct StudyToolsPane: View {
.padding(.vertical, 3)
.tag(tool.id)
}
.listStyle(.sidebar)
.paneListStyle()
.frame(width: 250)
Divider()
VStack(spacing: 0) {
Expand Down
31 changes: 31 additions & 0 deletions Packages/MarkdownRendering/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version: 6.1

import PackageDescription

// MarkdownView compiles its LaTeX support, and links SwiftMath, only when its
// `LaTeX` trait is on. The trait is on by default, but an Xcode project does
// not pass package traits before Xcode 26.4, so the app depended on it
// directly got neither and showed every formula as raw `$$…$$` source. Asking
// for the trait here, in a package manifest, turns it on whatever the Xcode.
let package = Package(
name: "MarkdownRendering",
platforms: [.macOS(.v14)],
products: [
.library(name: "MarkdownRendering", targets: ["MarkdownRendering"]),
],
dependencies: [
.package(
url: "https://github.com/LiYanan2004/MarkdownView",
from: "3.0.0",
traits: ["LaTeX"]
),
],
targets: [
.target(
name: "MarkdownRendering",
dependencies: [
.product(name: "MarkdownView", package: "MarkdownView"),
]
),
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// The app imports MarkdownView through this package, which is where its LaTeX
// trait is turned on. See Package.swift.
@_exported import MarkdownView
14 changes: 7 additions & 7 deletions project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ settings:
SWIFT_STRICT_CONCURRENCY: complete
SWIFT_TREAT_WARNINGS_AS_ERRORS: "NO"
ENABLE_USER_SCRIPT_SANDBOXING: NO
MARKETING_VERSION: "0.16.3"
CURRENT_PROJECT_VERSION: "22"
MARKETING_VERSION: "0.16.5"
CURRENT_PROJECT_VERSION: "23"
DEAD_CODE_STRIPPING: YES

packages:
Expand All @@ -27,10 +27,10 @@ packages:
url: https://github.com/sindresorhus/KeyboardShortcuts
from: 2.2.0
# Renders every piece of Markdown in the app: CommonMark/GFM, LaTeX through
# SwiftMath. See RichMarkdownView.
MarkdownView:
url: https://github.com/LiYanan2004/MarkdownView
from: 3.0.0
# SwiftMath. See RichMarkdownView. MarkdownView comes in through this local
# package, which turns on its LaTeX trait; see its Package.swift.
MarkdownRendering:
path: Packages/MarkdownRendering

targets:
ClassNote:
Expand Down Expand Up @@ -90,7 +90,7 @@ targets:
dependencies:
- package: GRDB
- package: KeyboardShortcuts
- package: MarkdownView
- package: MarkdownRendering
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.beluga.classnote
Expand Down
Loading