|
| 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 { save, open, pick, last, random, unread, starred, untagged, read, tag } from 'protocol-launcher/goodlinks'; |
| 9 | +import { SelectInstallationMethod } from '../../.vitepress/components'; |
| 10 | +import { saveParams, openParams, pickParams, tagParams } from '../../.vitepress/constants/goodlinks'; |
| 11 | + |
| 12 | +const currentMethod = ref('On-Demand'); |
| 13 | +const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/goodlinks' : 'protocol-launcher'); |
| 14 | +</script> |
| 15 | + |
| 16 | +# GoodLinks |
| 17 | + |
| 18 | +[GoodLinks](https://goodlinks.app/) is a read-it-later app for saving and reading links. **Protocol Launcher** allows you to generate GoodLinks x-callback-url actions exactly from the official URL scheme: save, open, pick, last, random, unread, starred, untagged, read, and tag. |
| 19 | + |
| 20 | +GoodLinks supports `x-success`, `x-error`, and `x-cancel` callback URLs. Pass them as `xSuccess`, `xError`, and `xCancel` when needed. |
| 21 | + |
| 22 | +## Usage |
| 23 | + |
| 24 | +There are two ways to use this library: |
| 25 | + |
| 26 | +- On-Demand import from subpaths enables tree-shaking and keeps bundles small. |
| 27 | +- Full Import from the root package is convenient but includes all app modules. |
| 28 | + |
| 29 | +Pick On-Demand for production builds; Full Import is fine for quick scripts or demos. |
| 30 | + |
| 31 | +<SelectInstallationMethod v-model="currentMethod" /> |
| 32 | + |
| 33 | +### Save Link |
| 34 | + |
| 35 | +```ts-vue [{{currentMethod}}] |
| 36 | +import { {{ currentMethod === 'On-Demand' ? 'save' : 'goodlinks' }} } from '{{ importPath }}' |
| 37 | +
|
| 38 | +const url = {{currentMethod === 'On-Demand' ? '' : 'goodlinks.'}}save({ |
| 39 | + url: 'https://apple.com', |
| 40 | + starred: '1', |
| 41 | + tags: 'apple ios', |
| 42 | +}) |
| 43 | +``` |
| 44 | + |
| 45 | +<div class="flex justify-center"> |
| 46 | + <VPLink :href="save(saveParams)" target="_self"> |
| 47 | + Save Link in GoodLinks |
| 48 | + </VPLink> |
| 49 | +</div> |
| 50 | + |
| 51 | +### Open Link |
| 52 | + |
| 53 | +```ts-vue [{{currentMethod}}] |
| 54 | +import { {{ currentMethod === 'On-Demand' ? 'open' : 'goodlinks' }} } from '{{ importPath }}' |
| 55 | +
|
| 56 | +const url = {{currentMethod === 'On-Demand' ? '' : 'goodlinks.'}}open({ |
| 57 | + url: 'https://example.com/article', |
| 58 | +}) |
| 59 | +``` |
| 60 | + |
| 61 | +<div class="flex justify-center"> |
| 62 | + <VPLink :href="open(openParams)" target="_self"> |
| 63 | + Open Link in GoodLinks |
| 64 | + </VPLink> |
| 65 | +</div> |
| 66 | + |
| 67 | +### Pick Link Details |
| 68 | + |
| 69 | +```ts-vue [{{currentMethod}}] |
| 70 | +import { {{ currentMethod === 'On-Demand' ? 'pick' : 'goodlinks' }} } from '{{ importPath }}' |
| 71 | +
|
| 72 | +const url = {{currentMethod === 'On-Demand' ? '' : 'goodlinks.'}}pick({ |
| 73 | + urlParam: 'link', |
| 74 | + titleParam: 'name', |
| 75 | + summaryParam: 'description', |
| 76 | +}) |
| 77 | +``` |
| 78 | + |
| 79 | +<div class="flex justify-center"> |
| 80 | + <VPLink :href="pick(pickParams)" target="_self"> |
| 81 | + Pick Link Details in GoodLinks |
| 82 | + </VPLink> |
| 83 | +</div> |
| 84 | + |
| 85 | +### Open Last Unread Link |
| 86 | + |
| 87 | +```ts-vue [{{currentMethod}}] |
| 88 | +import { {{ currentMethod === 'On-Demand' ? 'last' : 'goodlinks' }} } from '{{ importPath }}' |
| 89 | +
|
| 90 | +const url = {{currentMethod === 'On-Demand' ? '' : 'goodlinks.'}}last() |
| 91 | +``` |
| 92 | + |
| 93 | +<div class="flex justify-center"> |
| 94 | + <VPLink :href="last()" target="_self"> |
| 95 | + Open Last Unread Link in GoodLinks |
| 96 | + </VPLink> |
| 97 | +</div> |
| 98 | + |
| 99 | +### Open Random Unread Link |
| 100 | + |
| 101 | +```ts-vue [{{currentMethod}}] |
| 102 | +import { {{ currentMethod === 'On-Demand' ? 'random' : 'goodlinks' }} } from '{{ importPath }}' |
| 103 | +
|
| 104 | +const url = {{currentMethod === 'On-Demand' ? '' : 'goodlinks.'}}random() |
| 105 | +``` |
| 106 | + |
| 107 | +<div class="flex justify-center"> |
| 108 | + <VPLink :href="random()" target="_self"> |
| 109 | + Open Random Unread Link in GoodLinks |
| 110 | + </VPLink> |
| 111 | +</div> |
| 112 | + |
| 113 | +### Show Unread List |
| 114 | + |
| 115 | +```ts-vue [{{currentMethod}}] |
| 116 | +import { {{ currentMethod === 'On-Demand' ? 'unread' : 'goodlinks' }} } from '{{ importPath }}' |
| 117 | +
|
| 118 | +const url = {{currentMethod === 'On-Demand' ? '' : 'goodlinks.'}}unread() |
| 119 | +``` |
| 120 | + |
| 121 | +<div class="flex justify-center"> |
| 122 | + <VPLink :href="unread()" target="_self"> |
| 123 | + Show Unread List in GoodLinks |
| 124 | + </VPLink> |
| 125 | +</div> |
| 126 | + |
| 127 | +### Show Starred List |
| 128 | + |
| 129 | +```ts-vue [{{currentMethod}}] |
| 130 | +import { {{ currentMethod === 'On-Demand' ? 'starred' : 'goodlinks' }} } from '{{ importPath }}' |
| 131 | +
|
| 132 | +const url = {{currentMethod === 'On-Demand' ? '' : 'goodlinks.'}}starred() |
| 133 | +``` |
| 134 | + |
| 135 | +<div class="flex justify-center"> |
| 136 | + <VPLink :href="starred()" target="_self"> |
| 137 | + Show Starred List in GoodLinks |
| 138 | + </VPLink> |
| 139 | +</div> |
| 140 | + |
| 141 | +### Show Untagged List |
| 142 | + |
| 143 | +```ts-vue [{{currentMethod}}] |
| 144 | +import { {{ currentMethod === 'On-Demand' ? 'untagged' : 'goodlinks' }} } from '{{ importPath }}' |
| 145 | +
|
| 146 | +const url = {{currentMethod === 'On-Demand' ? '' : 'goodlinks.'}}untagged() |
| 147 | +``` |
| 148 | + |
| 149 | +<div class="flex justify-center"> |
| 150 | + <VPLink :href="untagged()" target="_self"> |
| 151 | + Show Untagged List in GoodLinks |
| 152 | + </VPLink> |
| 153 | +</div> |
| 154 | + |
| 155 | +### Show Read List |
| 156 | + |
| 157 | +```ts-vue [{{currentMethod}}] |
| 158 | +import { {{ currentMethod === 'On-Demand' ? 'read' : 'goodlinks' }} } from '{{ importPath }}' |
| 159 | +
|
| 160 | +const url = {{currentMethod === 'On-Demand' ? '' : 'goodlinks.'}}read() |
| 161 | +``` |
| 162 | + |
| 163 | +<div class="flex justify-center"> |
| 164 | + <VPLink :href="read()" target="_self"> |
| 165 | + Show Read List in GoodLinks |
| 166 | + </VPLink> |
| 167 | +</div> |
| 168 | + |
| 169 | +### Show Tagged Links |
| 170 | + |
| 171 | +```ts-vue [{{currentMethod}}] |
| 172 | +import { {{ currentMethod === 'On-Demand' ? 'tag' : 'goodlinks' }} } from '{{ importPath }}' |
| 173 | +
|
| 174 | +const url = {{currentMethod === 'On-Demand' ? '' : 'goodlinks.'}}tag({ |
| 175 | + name: 'apple', |
| 176 | +}) |
| 177 | +``` |
| 178 | + |
| 179 | +<div class="flex justify-center"> |
| 180 | + <VPLink :href="tag(tagParams)" target="_self"> |
| 181 | + Show Tagged Links in GoodLinks |
| 182 | + </VPLink> |
| 183 | +</div> |
0 commit comments