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
25 changes: 25 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Press <kbd>⌥N</kbd> in any app to write, and again to put it away. Notes are p
- **Math.** LaTeX formulas, `$…$` inline and `$$…$$` as blocks, rendered offline through [RaTeX](https://github.com/erweixin/RaTeX), with optional equation numbers and references.
- **Plain files.** Each note is a `.md` file. A save rewrites only the lines you edited and leaves the rest of the file unchanged.
- **Keyboard.** <kbd>⌘K</kbd> lists every action with its shortcut, <kbd>/</kbd> inserts a block, and vim mode can be turned on in Settings.
- **Context menu.** Right-click or Control-click to edit the selection, paste plain text or Markdown, and work with links, code blocks and tables using a native macOS menu.
- **Native.** Written in Rust and drawn with [GPUI](https://www.gpui.rs), without a web view.

<p align="center">
Expand Down Expand Up @@ -89,7 +90,8 @@ Bug reports and feature requests are welcome as issues. Pull requests are open t

**Report an Issue…** in <kbd>⌘K</kbd> opens an issue with your Mac and Markraft versions filled in. Logs and crash reports are written to `~/Library/Logs/Markraft` and stay on your Mac; attach the report if there is one.

To build from source:
To build from source, install Rust and Xcode 16 or newer with its command-line tools.
The macOS translation bridge is compiled with the bundled Swift compiler:

```sh
bash scripts/download-sparkle.sh # fetch the Sparkle framework into target/sparkle
Expand Down
5 changes: 4 additions & 1 deletion crates/markraft-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ libc = "0.2"
global-hotkey = "0.7"
tray-icon = { version = "0.21", default-features = false }
objc2 = "0.6"
block2 = "0.6"
objc2-natural-language = { version = "0.3.2", default-features = false, features = ["NLTagger", "NLTagScheme", "NLTokenizer"] }
objc2-app-kit = { version = "0.3.2", default-features = false, features = [
"NSBitmapImageRep", "NSButton", "NSColor", "NSControl", "NSFontDescriptor",
"NSApplication", "NSAttributedString", "NSPasteboard", "NSBitmapImageRep", "NSButton", "NSColor", "NSControl", "NSFontDescriptor",
"NSGraphics", "NSGraphicsContext", "NSImage", "NSImageRep", "NSResponder",
"NSStatusBarButton", "NSStatusItem", "NSView", "NSPrintInfo", "NSPrintOperation", "NSWindow",
"NSBezierPath", "NSWritingToolsCoordinator", "NSWritingToolsCoordinatorContext", "NSWritingToolsCoordinatorAnimationParameters", "block2",
"objc2-core-foundation",
] }
# Printing lays notes out with WebKit, which paginates HTML.
Expand Down
64 changes: 64 additions & 0 deletions crates/markraft-app/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,69 @@
fn main() {
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") {
println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path/../Frameworks");
build_translation();
}
}

fn build_translation() {
use std::path::PathBuf;
use std::process::Command;

const SOURCE: &str = "src/platform/translation.swift";
const PRESENTATION: &str = "src/platform/native_presentation.swift";
println!("cargo:rerun-if-changed={SOURCE}");
println!("cargo:rerun-if-changed={PRESENTATION}");
println!("cargo:rerun-if-env-changed=DEVELOPER_DIR");
let output = PathBuf::from(std::env::var_os("OUT_DIR").expect("Cargo sets OUT_DIR"));
let architecture = match std::env::var("CARGO_CFG_TARGET_ARCH").as_deref() {
Ok("aarch64") => "arm64",
Ok("x86_64") => "x86_64",
other => panic!("unsupported macOS translation target: {other:?}"),
};
let status = Command::new("xcrun")
.args([
"swiftc",
"-emit-library",
"-static",
"-parse-as-library",
"-module-name",
"MarkraftTranslation",
"-target",
])
.arg(format!("{architecture}-apple-macos13.0"))
.arg(SOURCE)
.arg(PRESENTATION)
.arg("-o")
.arg(output.join("libMarkraftTranslation.a"))
.status()
.expect("Xcode Swift compiler is required for macOS text translation");
assert!(
status.success(),
"failed to compile the system translation bridge"
);
let swiftc = Command::new("xcrun")
.args(["--find", "swiftc"])
.output()
.expect("locate Xcode Swift compiler");
assert!(
swiftc.status.success(),
"failed to locate the Swift compiler"
);
let swiftc = PathBuf::from(
String::from_utf8(swiftc.stdout)
.expect("Swift compiler path is UTF-8")
.trim(),
);
let runtime = swiftc
.parent()
.and_then(|path| path.parent())
.expect("Swift compiler belongs to an Xcode toolchain")
.join("lib/swift/macosx");
println!("cargo:rustc-link-search=native={}", output.display());
println!("cargo:rustc-link-search=native={}", runtime.display());
println!("cargo:rustc-link-lib=static=MarkraftTranslation");
println!("cargo:rustc-link-lib=dylib=swiftCore");
println!("cargo:rustc-link-lib=framework=SwiftUI");
println!("cargo:rustc-link-arg=-Wl,-weak_framework,Translation");
println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift");
}
58 changes: 56 additions & 2 deletions crates/markraft-app/locales/app/de.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"_version": 1,
"command": {
"copy-as-plain-text": "Als reinen Text kopieren",
"copy-as-html": "Als HTML-Code kopieren",
"copy-without-theme": "Ohne Designformatierung kopieren",
"clear-format": "Formatierung entfernen",
"highlight": "Hervorheben",
"insert-image": "Bild…",
"math-block": "Formelblock",
"insert-paragraph-before": "Absatz davor einfügen",
"insert-paragraph-after": "Absatz danach einfügen",
"copy-table": "Tabelle kopieren",
"traditional-chinese": "In traditionelles Chinesisch konvertieren",
"simplified-chinese": "In vereinfachtes Chinesisch konvertieren",
"add-column-left": "Spalte links einfügen",
"add-column-right": "Spalte rechts einfügen",
"add-row-above": "Zeile oberhalb einfügen",
Expand Down Expand Up @@ -71,7 +83,39 @@
"task-list": "Aufgabenliste",
"toggle-task": "Aufgabe umschalten",
"undo": "Widerrufen",
"unpin-note": "Notiz loslösen"
"unpin-note": "Notiz loslösen",
"search-web": "Im Web suchen",
"share-text": "Teilen …",
"uppercase": "Großbuchstaben",
"lowercase": "Kleinbuchstaben",
"capitalize": "Großschreibung",
"start-speaking": "Sprachausgabe starten",
"stop-speaking": "Sprachausgabe stoppen",
"check-spelling": "Dokument jetzt prüfen",
"check-continuously": "Rechtschreibung während der Texteingabe prüfen",
"check-grammar": "Grammatik und Rechtschreibung prüfen",
"correct-spelling": "Rechtschreibung automatisch korrigieren",
"ignore-spelling": "Schreibweise ignorieren",
"learn-spelling": "Schreibweise lernen",
"unlearn-spelling": "Schreibweise verlernen",
"smart-quotes": "Intelligente Anführungszeichen",
"smart-dashes": "Intelligente Bindestriche",
"text-replacement": "Textersetzung",
"smart-links": "Intelligente Links",
"data-detection": "Datenerkennung",
"paste-match-style": "Einsetzen und Stil anpassen",
"look-up-selection": "„%{text}“ nachschlagen",
"translate-selection": "„%{text}“ übersetzen",
"underline": "Unterstrichen",
"show-spelling": "Rechtschreibung und Grammatik einblenden",
"replace-quotes": "Anführungszeichen ersetzen",
"replace-dashes": "Bindestriche ersetzen",
"add-links": "Links hinzufügen",
"replace-text": "Text ersetzen",
"show-substitutions": "Ersetzungen einblenden",
"smart-copy-paste": "Intelligentes Kopieren/Einsetzen",
"hide-spelling": "Rechtschreibung und Grammatik ausblenden",
"hide-substitutions": "Ersetzungen ausblenden"
},
"notes": {
"title": "Notizen",
Expand All @@ -91,6 +135,10 @@
"no-matches": "Keine passenden Aktionen"
},
"menu": {
"copy-paste-as": "Kopieren / Einfügen als",
"paragraph": "Absatz",
"format": "Format",
"insert": "Einfügen",
"show-hide": "Notizen ein-/ausblenden",
"new-note": "Neue Notiz",
"settings": "Einstellungen …",
Expand All @@ -106,7 +154,13 @@
"select-all": "Alles auswählen",
"find": "Suchen …",
"find-next": "Weitersuchen",
"find-previous": "Vorheriges suchen"
"find-previous": "Vorheriges suchen",
"transformations": "Transformationen",
"speech": "Sprachausgabe",
"open-with": "Öffnen mit",
"spelling": "Rechtschreibung und Grammatik",
"substitutions": "Ersetzungen",
"font": "Schrift"
},
"input": {
"start-writing": "Losschreiben …",
Expand Down
58 changes: 56 additions & 2 deletions crates/markraft-app/locales/app/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"_version": 1,
"command": {
"copy-as-plain-text": "Copy as Plain Text",
"copy-as-html": "Copy as HTML Code",
"copy-without-theme": "Copy without Theme Styling",
"clear-format": "Clear Format",
"highlight": "Highlight",
"insert-image": "Image…",
"math-block": "Math Block",
"insert-paragraph-before": "Insert Paragraph Before",
"insert-paragraph-after": "Insert Paragraph After",
"copy-table": "Copy Table",
"traditional-chinese": "Convert to Traditional Chinese",
"simplified-chinese": "Convert to Simplified Chinese",
"add-column-left": "Add Column Left",
"add-column-right": "Add Column Right",
"add-row-above": "Add Row Above",
Expand Down Expand Up @@ -71,7 +83,39 @@
"task-list": "Task List",
"toggle-task": "Toggle Task",
"undo": "Undo",
"unpin-note": "Unpin Note"
"unpin-note": "Unpin Note",
"search-web": "Search the Web",
"share-text": "Share…",
"uppercase": "Make Upper Case",
"lowercase": "Make Lower Case",
"capitalize": "Capitalize",
"start-speaking": "Start Speaking",
"stop-speaking": "Stop Speaking",
"check-spelling": "Check Document Now",
"check-continuously": "Check Spelling While Typing",
"check-grammar": "Check Grammar With Spelling",
"correct-spelling": "Correct Spelling Automatically",
"ignore-spelling": "Ignore Spelling",
"learn-spelling": "Learn Spelling",
"unlearn-spelling": "Unlearn Spelling",
"smart-quotes": "Smart Quotes",
"smart-dashes": "Smart Dashes",
"text-replacement": "Text Replacement",
"smart-links": "Smart Links",
"data-detection": "Data Detectors",
"paste-match-style": "Paste and Match Style",
"look-up-selection": "Look Up “%{text}”",
"translate-selection": "Translate “%{text}”",
"underline": "Underline",
"show-spelling": "Show Spelling and Grammar",
"replace-quotes": "Replace Quotes",
"replace-dashes": "Replace Dashes",
"add-links": "Add Links",
"replace-text": "Replace Text",
"show-substitutions": "Show Substitutions",
"smart-copy-paste": "Smart Copy/Paste",
"hide-spelling": "Hide Spelling and Grammar",
"hide-substitutions": "Hide Substitutions"
},
"notes": {
"title": "Notes",
Expand All @@ -91,6 +135,10 @@
"no-matches": "No matching actions"
},
"menu": {
"copy-paste-as": "Copy / Paste As",
"paragraph": "Paragraph",
"format": "Format",
"insert": "Insert",
"show-hide": "Show / Hide Notes",
"new-note": "New Note",
"settings": "Settings…",
Expand All @@ -106,7 +154,13 @@
"select-all": "Select All",
"find": "Find…",
"find-next": "Find Next",
"find-previous": "Find Previous"
"find-previous": "Find Previous",
"transformations": "Transformations",
"speech": "Speech",
"open-with": "Open With",
"spelling": "Spelling and Grammar",
"substitutions": "Substitutions",
"font": "Font"
},
"input": {
"start-writing": "Start writing…",
Expand Down
Loading
Loading