aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorRuben Beltran del Rio <jj@r.bdr.sh>2026-06-14 17:07:38 +0200
committerRuben Beltran del Rio <jj@r.bdr.sh>2026-06-15 13:38:02 +0200
commit3402f5764f794a60f85a152a13c4eacaa2a719f6 (patch)
tree9fafe13da4caee303313033e313461a556f9f495 /README.md
Extract from Norganizer
Diffstat (limited to 'README.md')
-rw-r--r--README.md65
1 files changed, 65 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..dc8cec4
--- /dev/null
+++ b/README.md
@@ -0,0 +1,65 @@
+# Norg Keyboard Toolbar
+
+This package provides a toolbar you can use whenever you need to edit norg
+files. The toolbar provides the following buttons:
+
+The heading button creates a new heading, or increases the heading of the
+current level. See this table for examples.
+
+| Starting State | Resulting State |
+|----------------|-----------------|
+| * ⏐ | ** ⏐ |
+| * ⏐ Hello | ** ⏐ Hello |
+| * Hello ⏐ | * Hello\n* ⏐ |
+| Hello ⏐ | Hello\n* ⏐ |
+
+The task button creates a task on a new line, unless it's at the beginning of
+a heading or list, in which case it adds the task to the list.
+
+| Starting State | Resulting State |
+|----------------|-----------------|
+| * ⏐ | * ( ) ⏐ |
+| * ⏐ Hello | * ( ) ⏐ Hello |
+| * Hello ⏐ | * Hello\n- ( )⏐ |
+| Hello ⏐ | Hello\n- ( ) ⏐ |
+| ~ ⏐ | ~ ( ) ⏐ |
+
+The reverse heading buttons add `---` or `===` in a new line.
+
+The code button adds a `@code` and `@end` block.
+
+## Usage
+
+Add the package to your project by including the repo URL with Xcode's package
+manager, and import it:
+
+```swift
+import SwiftUI
+import NorgKeyboardToolbar
+
+struct EditorView: View {
+ @State private var draft = ""
+ @State private var selection: TextSelection?
+
+ var body: some View {
+ TextEditor(text: $draft, selection: $selection)
+ .toolbar {
+ NorgKeyboardToolbar(text: $draft, selection: $selection)
+ }
+ }
+}
+```
+
+`NorgKeyboardToolbar` then places a toolbar above the keyboard (or the bottom
+of the screen if a hardware keyboard is connected.) with the buttons described
+above.
+
+## Development
+
+A `Justfile` is provided to run common tasks:
+
+- `just build`, build the code.
+- `just test`, run tests.
+- `just coverage`, view coverage information.
+- `just format`, format and apply lint fixes.
+- `just lint`, lint the code.