Skip to content

Commit 505a246

Browse files
committed
feat: add md rendering via glamour
1 parent 4a84725 commit 505a246

File tree

10 files changed

+192
-100
lines changed

10 files changed

+192
-100
lines changed

cmd/guide.go

Lines changed: 88 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import (
99
"github.com/dhth/omm/internal/types"
1010
)
1111

12+
const (
13+
codeBlockMarker = "```"
14+
)
15+
1216
type entry struct {
1317
summary string
1418
ctx string
@@ -19,21 +23,21 @@ func insertGuideTasks(db *sql.DB) error {
1923
var entries = []entry{
2024
{
2125
"guide: welcome to omm",
22-
`Hi there 👋 Thanks for trying out omm.
26+
fmt.Sprintf(`Hi there 👋 Thanks for trying out **omm**.
2327
2428
This is a guided walkthrough to get you acquainted with omm's features.
2529
2630
Before we begin, let's get the basics out of the way: you exit omm by pressing
27-
q/esc/ctrl+c. These keys also move you back menus/panes whilst using omm's TUI.
31+
%s. These keys also move you back menus/panes whilst using omm's TUI.
2832
29-
Onwards with the walkthrough then! Simply press j/↓, and follow the
33+
Onwards with the walkthrough then! Simply press %s, and follow the
3034
instructions.
31-
`,
35+
`, "`q/esc/<ctrl+c>`", "`j/↓`"),
3236
true,
3337
},
3438
{
3539
"domain: tasks",
36-
`omm ("on-my-mind") is a task manager. You can also think of it as a keyboard
40+
`omm (**on-my-mind**) is a task manager. You can also think of it as a keyboard
3741
driven to-do list.
3842
3943
As such, tasks are at the core of omm. A task can be anything that you want to
@@ -48,176 +52,181 @@ you want to save details that don't fit in a single line.
4852
},
4953
{
5054
"domain: task state",
51-
`A task can be in one of two states: active or archived.
55+
fmt.Sprintf(`A task can be in one of two states: **active** or **archived**.
5256
5357
This list shows active tasks.
5458
5559
To be pedantic about things, only the tasks in the active list are supposed to
5660
be "on your mind". However, there are benefits to having a list of archived
5761
tasks as well.
5862
59-
Press <tab> to see the archived list.
60-
`,
63+
Press %s to see the archived list.
64+
`, "`<tab>`"),
6165
true,
6266
},
6367
{
6468
"domain: task details",
65-
`The "Task Details" pane is intended for when you simply want to read all the
69+
fmt.Sprintf(`The **Task Details** pane is intended for when you simply want to read all the
6670
details associated with a task in a full screen view.
6771
68-
You can view this pane by pressing "d".
72+
You can view this pane by pressing %s. This pane is useful when a task's
73+
context is too long to fit in the context pane.
6974
7075
Whilst in this pane, you can move backwards and forwards in the
71-
task list by pressing "h/<-/->/l". You quit out of this pane by either pressing
72-
"d" again, or q/esc/ctrl+c.
76+
task list by pressing %s. You quit out of this pane by either pressing
77+
%s again, or %s.
7378
7479
Try it out. Come back to this entry when you're done.
75-
`,
80+
`, "`d`", "`h/<-/->/l`", "`d`", "`q/esc/<ctrl+c>`"),
7681
true,
7782
},
7883
{
7984
"domain: an archived task",
80-
`This is the archived list, meaning it holds tasks that are no longer being
81-
worked on.
85+
fmt.Sprintf(`This is the **Archived Tasks** list, meaning it holds tasks that are no longer
86+
being worked on.
8287
8388
omm provides this list both for historical reference, as well as for you to be
8489
able to move an archived task back into the active list.
8590
86-
You can toggle the state of a task using <ctrl+d>.
91+
You can toggle the state of a task using %s.
8792
88-
Press tab/q/esc/ctrl+c to go back to the active list.
89-
`,
93+
Press %s to go back to the active list.
94+
`, "`ctrl+d`", "`tab/q/esc/<ctrl+c>`"),
9095
false,
9196
},
9297
{
9398
"visuals: list density",
94-
`omm's task lists can be viewed in two density modes: compact and spacious.
99+
fmt.Sprintf(`omm's task lists can be viewed in two density modes: **compact** and **spacious**.
95100
96101
This is the compact mode. As opposed to this, the spacious mode shows tasks in a
97102
more roomier list, alongside highlighting prefixes (we'll see what that means),
98103
and showing creation timestamps.
99104
100105
omm starts up with spacious mode by default (you can change this, as we'll see
101-
soon). You can toggle between the two modes by pressing "v". Choose whichever
106+
soon). You can toggle between the two modes by pressing %s. Choose whichever
102107
mode fits your workflow better.
103108
104109
Try it out. Come back to this mode once you're done.
105-
`,
110+
`, "`v`"),
106111
true,
107112
},
108113
{
109114
"visuals: toggling context pane",
110-
`The context pane can be toggled on/off by pressing "C".
115+
fmt.Sprintf(`The context pane can be toggled on/off by pressing %s.
111116
112117
You can choose to display it or not based on your preference. For convenience,
113118
the lists will always highlight tasks that have a context associated with them
114-
by having a "(c)" marker on them.
119+
by having a **(c)** marker on them.
115120
116121
omm starts up with the context pane hidden by default (you can change this, as
117122
we'll see soon).
118-
`,
123+
`, "`C`"),
119124
true,
120125
},
121126
{
122127
"actions: adding tasks",
123-
`Let's get to the crux of omm: adding and prioritizing tasks. We'll
128+
fmt.Sprintf(`Let's get to the crux of omm: **adding and prioritizing tasks**. We'll
124129
begin with adding tasks.
125130
126-
You can add a task below the cursor by pressing "a". Once you get acquainted
131+
You can add a task below the cursor by pressing %s. Once you get acquainted
127132
with omm, you'll want to have more control on the position of the newly added
128133
task. omm offers the following keymaps for that.
129134
130-
o/a add task below cursor
131-
O add task above cursor
132-
I add task at the top
133-
A add task at the end
135+
o/a add task below cursor
136+
O add task above cursor
137+
I add task at the top
138+
A add task at the end
134139
135140
Go ahead, create a task, then move to the next guided item.
136-
`,
141+
`, "`a`"),
137142
true,
138143
},
139144
{
140145
"cli: adding a task via the CLI",
141-
`You can also add a task to omm via its command line interface. For example:
146+
fmt.Sprintf(`You can also add a task to omm via its command line interface. For example:
142147
148+
%sbash
143149
omm 'prefix: a task summary'
150+
%s
144151
145152
This will add an entry to the top of the active tasks list.
146-
`,
153+
`, codeBlockMarker, codeBlockMarker),
147154
true,
148155
},
149156
{
150157
"cli: importing several tasks via the CLI",
151-
`You can also import more than one task at a time by using the "import"
158+
fmt.Sprintf(`You can also import more than one task at a time by using the **"import"**
152159
subcommand. For example:
153160
161+
%sbash
154162
cat << 'EOF' | omm import
155163
orders: order new ACME rocket skates
156164
traps: draw fake tunnel on the canyon wall
157165
tech: assemble ACME jet-propelled pogo stick
158166
EOF
167+
%s
159168
160169
omm will expect each line in stdin to hold one task's summary.
161-
`,
170+
`, codeBlockMarker, codeBlockMarker),
162171
true,
163172
},
164173
{
165174
"actions: adding context",
166-
`As mentioned before, once a task is created, you might want to add context to
175+
fmt.Sprintf(`As mentioned before, once a task is created, you might want to add context to
167176
it.
168177
169-
You do that by pressing "c". Go ahead, try it out. Try changing the text, and
178+
You do that by pressing %s. Go ahead, try it out. Try changing the text, and
170179
then save the file. This context text should get updated accordingly.
171180
172-
Once saved, you can also copy a tasks's context to your system clipboard by pressing "y".
173-
`,
181+
Once saved, you can also copy a tasks's context to your system clipboard by pressing %s.
182+
`, "`c`", "`y`"),
174183
true,
175184
},
176185
{
177186
"actions: filtering tasks",
178-
`You can filter tasks in a list by pressing "/". Doing this will open up a search
187+
fmt.Sprintf(`You can filter tasks in a list by pressing %s. Doing this will open up a search
179188
prompt, which will match your query with task prefixes.
180189
181-
Try it out now. You get out of the filtered state by pressing "q/esc/ctrl+c".
190+
Try it out now. You get out of the filtered state by pressing %s.
182191
183192
Note: You cannot add tasks or move them around in a filtered state. But, you can
184-
move a task to the top of the list (by pressing ). Doing this will also get you
193+
move a task to the top of the list (by pressing %s). Doing this will also get you
185194
out of the filtered state.
186-
`,
195+
`, "`/`", "`q/esc/<ctrl+c>`", "`⏎`"),
187196
true,
188197
},
189198
{
190199
"actions: quick filtering via a list",
191-
`You can also choose the prefix you want to filter by with the means of a list,
192-
hereby called as the "Quick Filter List". Press "ctrl+p" to open up a set of
193-
task prefixes contained in the currently active task list. Press to
200+
fmt.Sprintf(`You can also choose the prefix you want to filter by with the means of a list,
201+
hereby called as the **Quick Filter List**. Press %s to open up a set of
202+
task prefixes contained in the currently active task list. Press %s to
194203
pre-populate the task list's search prompt with your selection.
195204
196205
Try it out now.
197206
198-
Note: Both the "Active Tasks List" and "Archived Tasks List" can be filtered
199-
separately, using either the manual filtering approach or via the "Quick Filter
200-
List".
201-
`,
207+
Note: Both the **Active Tasks List** and **Archived Tasks List** can be filtered
208+
separately, using either the manual filtering approach or via the **Quick Filter
209+
List**.
210+
`, "`ctrl+p`", "`⏎`"),
202211
true,
203212
},
204213
{
205214
"domain: task bookmarks",
206-
`Sometimes you'll add URLs to a task's summary or its context.
215+
fmt.Sprintf(`Sometimes you'll add URLs to a task's summary or its context.
207216
208217
Such URLs (eg. https://github.com/dhth/omm, https://tools.dhruvs.space,
209218
https://c.xkcd.com/random/comic) could be placed anywhere in the summary/
210219
context.
211220
212-
omm lets you open these URLs via a single keypress. You can either press "b" to
213-
open up a list of all URLs, and then open one of them by pressing , or open all
214-
of them by pressing "B".
221+
omm lets you open these URLs via a single keypress. You can either press %s to
222+
open up a list of all URLs, and then open one of them by pressing %s, or open all
223+
of them by pressing %s.
215224
216-
Note: if the task has a single URL added to it, pressing "b" will skip showing
225+
Note: if the task has a single URL added to it, pressing %s will skip showing
217226
the list, and open the URL directly.
218227
219-
Try both approaches now. Press "b", interact with the list, and then press "B".
220-
`,
228+
Try both approaches now.
229+
`, "`b`", "`⏎`", "`B`", "`b`"),
221230
true,
222231
},
223232
{
@@ -229,9 +238,9 @@ And, as we all know, priorities often change. You're probably juggling multiple
229238
tasks on any given day. As such, omm allows you to move tasks around in the
230239
priority order. It has the following keymaps to achieve this:
231240
232-
⏎ move task to the top
233-
J move task one position down
234-
K move task one position up
241+
⏎ move task to the top
242+
J move task one position down
243+
K move task one position up
235244
236245
It's recommended that you move the task that you're currently focussing on to
237246
the top.
@@ -240,52 +249,57 @@ the top.
240249
},
241250
{
242251
"actions: updating task details",
243-
`Once a task is created, its summary and context can be changed at any point.
252+
fmt.Sprintf(`Once a task is created, its summary and context can be changed at any point.
244253
245-
You can update a task's summary by pressing "u".
254+
You can update a task's summary by pressing %s.
246255
247256
This will open up the the same prompt you saw when creating a new task, with the
248257
only difference that the task's summary will be pre-filled for you. This can
249258
come in handy when you want to quickly jot down a task for yourself (either by
250-
using the TUI, or by using the CLI (eg. "omm 'a hastily written task summary")),
259+
using the TUI, or by using the CLI (eg. %s)),
251260
and then come back to it later to refine it more.
252261
253-
Similarly, you can also update a task's context any time (by pressing "c").
254-
`,
262+
Similarly, you can also update a task's context any time (by pressing %s).
263+
`, "`u`", "`omm 'a hastily written task summary'`", "`c`"),
255264
true,
256265
},
257266
{
258267
"config: changing the defaults",
259-
`omm allows you to change the some of its behavior via configuration, which it
268+
fmt.Sprintf(`omm allows you to change the some of its behavior via configuration, which it
260269
will consider in the order listed below:
261270
262-
- CLI flags (run "omm -h" to see details)
263-
- Environment variables (eg. "OMM_EDITOR")
264-
- A TOML configuration file (run "omm -h" to see where this lives; you can
265-
change this via the flag "--config-path")
271+
- CLI flags (run %s to see details)
272+
- Environment variables (eg. %s)
273+
- A TOML configuration file (run %s to see where this lives; you can
274+
change this via the flag %s)
266275
267276
omm will consider configuration in the order laid out above, ie, CLI flags will
268277
take the highest priority.
269-
`,
278+
`, "`omm -h`", "`$OMM_EDITOR`", "`omm -h`", "`--config-path`"),
270279
true,
271280
},
272281
{
273282
"config: flags, env vars, and config file",
274-
`Every flag listed by "omm -h" (except "--config-path") has an environment
283+
fmt.Sprintf(`Every flag listed by %s (except %s) has an environment
275284
variable counterpart, as well as a TOML config counterpart.
276285
277286
For example:
278287
288+
%stext
279289
--show-context -> OMM_SHOW_CONTEXT -> show_context
280290
--editor -> OMM_EDITOR -> editor
281-
`,
291+
%s
292+
`, "`omm -h`", "`--config-path`", codeBlockMarker, codeBlockMarker),
282293
true,
283294
},
284295
{
285296
"config: a sample TOML config",
286297
fmt.Sprintf(`Here's a sample TOML configuration file:
287298
288-
%s`, sampleCfg),
299+
%stoml
300+
%s
301+
%s
302+
`, codeBlockMarker, sampleCfg, codeBlockMarker),
289303
true,
290304
},
291305
{

0 commit comments

Comments
 (0)