|
| 1 | +--- |
| 2 | +layout: doc |
| 3 | +--- |
| 4 | + |
| 5 | +<script setup lang="ts"> |
| 6 | +import { ref, computed } from 'vue'; |
| 7 | +import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue'; |
| 8 | +import { open, openItem, newSheet, insert, attachNote, attachKeywords, newGroup, copy, openAll, openFavorites, openRecent } from 'protocol-launcher/ulysses'; |
| 9 | +import { SelectInstallationMethod } from '../../.vitepress/components'; |
| 10 | +import { openItemParams, newSheetParams, insertParams, attachNoteParams, attachKeywordsParams, newGroupParams, copyParams } from '../../.vitepress/constants/ulysses'; |
| 11 | + |
| 12 | +const currentMethod = ref('On-Demand'); |
| 13 | +const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/ulysses' : 'protocol-launcher'); |
| 14 | +</script> |
| 15 | + |
| 16 | +# Ulysses |
| 17 | + |
| 18 | +[Ulysses](https://ulysses.app/) is a powerful writing app for Mac, iPad and iPhone. **Protocol Launcher** allows you to generate deep links to create and manage sheets, groups, and notes in Ulysses. |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | +There are two ways to use this library: |
| 23 | + |
| 24 | +- On-Demand import from subpaths enables tree-shaking and keeps bundles small. |
| 25 | +- Full Import from the root package is convenient but includes all app modules. |
| 26 | + |
| 27 | +Pick On-Demand for production builds; Full Import is fine for quick scripts or demos. |
| 28 | + |
| 29 | +<SelectInstallationMethod v-model="currentMethod" /> |
| 30 | + |
| 31 | +### Open App |
| 32 | + |
| 33 | +```ts-vue [{{currentMethod}}] |
| 34 | +import { {{ currentMethod === 'On-Demand' ? 'open' : 'ulysses' }} } from '{{ importPath }}' |
| 35 | +
|
| 36 | +const url = {{currentMethod === 'On-Demand' ? '' : 'ulysses.'}}open() |
| 37 | +``` |
| 38 | + |
| 39 | +<div class="flex justify-center"> |
| 40 | + <VPLink :href="open()" target="_self"> |
| 41 | + Open Ulysses |
| 42 | + </VPLink> |
| 43 | +</div> |
| 44 | + |
| 45 | +### Open Item |
| 46 | + |
| 47 | +Open a sheet or group by identifier, name, or path. |
| 48 | + |
| 49 | +```ts-vue [{{currentMethod}}] |
| 50 | +import { {{ currentMethod === 'On-Demand' ? 'openItem' : 'ulysses' }} } from '{{ importPath }}' |
| 51 | +
|
| 52 | +const url = {{currentMethod === 'On-Demand' ? '' : 'ulysses.'}}openItem({ |
| 53 | + id: 'DCj45UWKr_g15y2vBPwJdQ', |
| 54 | +}) |
| 55 | +``` |
| 56 | + |
| 57 | +<div class="flex justify-center"> |
| 58 | + <VPLink :href="openItem(openItemParams)" target="_self"> |
| 59 | + Open Item in Ulysses |
| 60 | + </VPLink> |
| 61 | +</div> |
| 62 | + |
| 63 | +### New Sheet |
| 64 | + |
| 65 | +Create a new sheet with optional content, group, format, and position. |
| 66 | + |
| 67 | +```ts-vue [{{currentMethod}}] |
| 68 | +import { {{ currentMethod === 'On-Demand' ? 'newSheet' : 'ulysses' }} } from '{{ importPath }}' |
| 69 | +
|
| 70 | +const url = {{currentMethod === 'On-Demand' ? '' : 'ulysses.'}}newSheet({ |
| 71 | + text: 'My new sheet content', |
| 72 | + group: '/Books', |
| 73 | + format: 'markdown', |
| 74 | + index: 0, |
| 75 | +}) |
| 76 | +``` |
| 77 | + |
| 78 | +<div class="flex justify-center"> |
| 79 | + <VPLink :href="newSheet(newSheetParams)" target="_self"> |
| 80 | + Create New Sheet |
| 81 | + </VPLink> |
| 82 | +</div> |
| 83 | + |
| 84 | +### Insert Text |
| 85 | + |
| 86 | +Insert or append text to an existing sheet. |
| 87 | + |
| 88 | +```ts-vue [{{currentMethod}}] |
| 89 | +import { {{ currentMethod === 'On-Demand' ? 'insert' : 'ulysses' }} } from '{{ importPath }}' |
| 90 | +
|
| 91 | +const url = {{currentMethod === 'On-Demand' ? '' : 'ulysses.'}}insert({ |
| 92 | + id: 'H8zLAmc1I0njH-0Ql-3YGQ', |
| 93 | + text: 'Inserted text', |
| 94 | + format: 'markdown', |
| 95 | + position: 'end', |
| 96 | + newline: 'prepend', |
| 97 | +}) |
| 98 | +``` |
| 99 | + |
| 100 | +<div class="flex justify-center"> |
| 101 | + <VPLink :href="insert(insertParams)" target="_self"> |
| 102 | + Insert Text in Ulysses |
| 103 | + </VPLink> |
| 104 | +</div> |
| 105 | + |
| 106 | +### Attach Note |
| 107 | + |
| 108 | +Attach a note to a sheet. |
| 109 | + |
| 110 | +```ts-vue [{{currentMethod}}] |
| 111 | +import { {{ currentMethod === 'On-Demand' ? 'attachNote' : 'ulysses' }} } from '{{ importPath }}' |
| 112 | +
|
| 113 | +const url = {{currentMethod === 'On-Demand' ? '' : 'ulysses.'}}attachNote({ |
| 114 | + id: 'H8zLAmc1I0njH-0Ql-3YGQ', |
| 115 | + text: 'My new note', |
| 116 | + format: 'markdown', |
| 117 | +}) |
| 118 | +``` |
| 119 | + |
| 120 | +<div class="flex justify-center"> |
| 121 | + <VPLink :href="attachNote(attachNoteParams)" target="_self"> |
| 122 | + Attach Note in Ulysses |
| 123 | + </VPLink> |
| 124 | +</div> |
| 125 | + |
| 126 | +### Attach Keywords |
| 127 | + |
| 128 | +Add keywords to a sheet. |
| 129 | + |
| 130 | +```ts-vue [{{currentMethod}}] |
| 131 | +import { {{ currentMethod === 'On-Demand' ? 'attachKeywords' : 'ulysses' }} } from '{{ importPath }}' |
| 132 | +
|
| 133 | +const url = {{currentMethod === 'On-Demand' ? '' : 'ulysses.'}}attachKeywords({ |
| 134 | + id: 'H8zLAmc1I0njH-0Ql-3YGQ', |
| 135 | + keywords: 'Draft,Important', |
| 136 | +}) |
| 137 | +``` |
| 138 | + |
| 139 | +<div class="flex justify-center"> |
| 140 | + <VPLink :href="attachKeywords(attachKeywordsParams)" target="_self"> |
| 141 | + Attach Keywords in Ulysses |
| 142 | + </VPLink> |
| 143 | +</div> |
| 144 | + |
| 145 | +### New Group |
| 146 | + |
| 147 | +Create a new group for organizing sheets. |
| 148 | + |
| 149 | +```ts-vue [{{currentMethod}}] |
| 150 | +import { {{ currentMethod === 'On-Demand' ? 'newGroup' : 'ulysses' }} } from '{{ importPath }}' |
| 151 | +
|
| 152 | +const url = {{currentMethod === 'On-Demand' ? '' : 'ulysses.'}}newGroup({ |
| 153 | + name: 'My Group', |
| 154 | + parent: '/Books', |
| 155 | + index: 0, |
| 156 | +}) |
| 157 | +``` |
| 158 | + |
| 159 | +<div class="flex justify-center"> |
| 160 | + <VPLink :href="newGroup(newGroupParams)" target="_self"> |
| 161 | + Create New Group |
| 162 | + </VPLink> |
| 163 | +</div> |
| 164 | + |
| 165 | +### Copy Item |
| 166 | + |
| 167 | +Copy a sheet or group to a target location. |
| 168 | + |
| 169 | +```ts-vue [{{currentMethod}}] |
| 170 | +import { {{ currentMethod === 'On-Demand' ? 'copy' : 'ulysses' }} } from '{{ importPath }}' |
| 171 | +
|
| 172 | +const url = {{currentMethod === 'On-Demand' ? '' : 'ulysses.'}}copy({ |
| 173 | + id: 'hZ7IX2jqKbVmPGlYUXkZjQ', |
| 174 | + targetGroup: 'H8zLAmc1I0njH-0Ql-3YGQ', |
| 175 | + index: 4, |
| 176 | +}) |
| 177 | +``` |
| 178 | + |
| 179 | +<div class="flex justify-center"> |
| 180 | + <VPLink :href="copy(copyParams)" target="_self"> |
| 181 | + Copy Item in Ulysses |
| 182 | + </VPLink> |
| 183 | +</div> |
| 184 | + |
| 185 | +### Open All |
| 186 | + |
| 187 | +Open the special "All" group showing all sheets. |
| 188 | + |
| 189 | +```ts-vue [{{currentMethod}}] |
| 190 | +import { {{ currentMethod === 'On-Demand' ? 'openAll' : 'ulysses' }} } from '{{ importPath }}' |
| 191 | +
|
| 192 | +const url = {{currentMethod === 'On-Demand' ? '' : 'ulysses.'}}openAll() |
| 193 | +``` |
| 194 | + |
| 195 | +<div class="flex justify-center"> |
| 196 | + <VPLink :href="openAll()" target="_self"> |
| 197 | + Open All in Ulysses |
| 198 | + </VPLink> |
| 199 | +</div> |
| 200 | + |
| 201 | +### Open Favorites |
| 202 | + |
| 203 | +Open the special "Favorites" group. |
| 204 | + |
| 205 | +```ts-vue [{{currentMethod}}] |
| 206 | +import { {{ currentMethod === 'On-Demand' ? 'openFavorites' : 'ulysses' }} } from '{{ importPath }}' |
| 207 | +
|
| 208 | +const url = {{currentMethod === 'On-Demand' ? '' : 'ulysses.'}}openFavorites() |
| 209 | +``` |
| 210 | + |
| 211 | +<div class="flex justify-center"> |
| 212 | + <VPLink :href="openFavorites()" target="_self"> |
| 213 | + Open Favorites in Ulysses |
| 214 | + </VPLink> |
| 215 | +</div> |
| 216 | + |
| 217 | +### Open Recent |
| 218 | + |
| 219 | +Open the special "Last 7 Days" (Recent) group. |
| 220 | + |
| 221 | +```ts-vue [{{currentMethod}}] |
| 222 | +import { {{ currentMethod === 'On-Demand' ? 'openRecent' : 'ulysses' }} } from '{{ importPath }}' |
| 223 | +
|
| 224 | +const url = {{currentMethod === 'On-Demand' ? '' : 'ulysses.'}}openRecent() |
| 225 | +``` |
| 226 | + |
| 227 | +<div class="flex justify-center"> |
| 228 | + <VPLink :href="openRecent()" target="_self"> |
| 229 | + Open Recent in Ulysses |
| 230 | + </VPLink> |
| 231 | +</div> |
0 commit comments