void 0.1.6 β†’ 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/AGENT_PROMPT.md +15 -0
  2. package/README.md +62 -123
  3. package/dist/auth-BdsJ0Aff.d.mts +43 -0
  4. package/dist/auth-cmd-Dx8oPKZC.mjs +43 -0
  5. package/dist/auth-migrations-BAtAck2g.mjs +117 -0
  6. package/dist/better-auth-shared-C9_GHSkR.d.mts +71 -0
  7. package/dist/better-auth-shared-CdYmQGry.mjs +163 -0
  8. package/dist/cache-W82I8ihI.mjs +47 -0
  9. package/dist/cancel-deploy-BOBTqqh0.mjs +59 -0
  10. package/dist/cf-access-Dee5cXxL.mjs +22 -0
  11. package/dist/chunk-DJd-R1mw.mjs +34 -0
  12. package/dist/cli/cli.d.mts +1 -0
  13. package/dist/cli/cli.mjs +1807 -0
  14. package/dist/client-snXOjrp1.mjs +565 -0
  15. package/dist/collect-CjeZgz5D.mjs +55 -0
  16. package/dist/config-BIa9HwVX.mjs +573 -0
  17. package/dist/config-BzM9Dy7T.mjs +37 -0
  18. package/dist/config-CvHtTM0q.mjs +30 -0
  19. package/dist/create-project-BIA15W7z.mjs +90 -0
  20. package/dist/db-DsRoMcfN.mjs +895 -0
  21. package/dist/defer-DcxEsVH1.mjs +49 -0
  22. package/dist/delete-DAP6yDc7.mjs +64 -0
  23. package/dist/deploy-BPKblFx6.mjs +2424 -0
  24. package/dist/discover-B7FkXBLB.mjs +40 -0
  25. package/dist/dist-DUyXJLkq.mjs +2667 -0
  26. package/dist/dist-Dayj3gCK.mjs +1287 -0
  27. package/dist/domain-BGofcQ6I.mjs +79 -0
  28. package/dist/dotenv-DwO4ti0Z.mjs +173 -0
  29. package/dist/drizzle-NnudE_UN.mjs +232 -0
  30. package/dist/env-CyG3tvU0.mjs +301 -0
  31. package/dist/env-helpers-Dr9Y7RnE.d.mts +52 -0
  32. package/dist/env-raw-BDL4TvdN.mjs +32 -0
  33. package/dist/env-types-DknSA4SO.mjs +64 -0
  34. package/dist/env-validation-DJKjR_8q.mjs +163 -0
  35. package/dist/fetch-error-BQ8sZ5Nd.mjs +266 -0
  36. package/dist/fetch-error-CVZ5CGA-.d.mts +20 -0
  37. package/dist/gen-U0Ktr4Zd.mjs +761 -0
  38. package/dist/handler-B0ds0OHJ.d.mts +269 -0
  39. package/dist/head-P-egrtFE.d.mts +45 -0
  40. package/dist/headers-DCXc7mDs.mjs +279 -0
  41. package/dist/index.d.mts +32 -0
  42. package/dist/index.mjs +4695 -0
  43. package/dist/init-C7wS5iGP.mjs +2625 -0
  44. package/dist/link-p2R6NbgN.mjs +49 -0
  45. package/dist/list-Bfel-QLc.mjs +113 -0
  46. package/dist/log-DXdqnmhF.mjs +26 -0
  47. package/dist/login-CkcXUiIu.mjs +72 -0
  48. package/dist/logs-DmkrRvx6.mjs +98 -0
  49. package/dist/magic-string.es-D6g9UnIy.mjs +1011 -0
  50. package/dist/mcp-CaQzfeUi.mjs +373 -0
  51. package/dist/node-DDfXj10V.mjs +54 -0
  52. package/dist/output-BwlcIYSR.mjs +139 -0
  53. package/dist/pages/client.d.mts +198 -0
  54. package/dist/pages/client.mjs +980 -0
  55. package/dist/pages/head-client.d.mts +15 -0
  56. package/dist/pages/head-client.mjs +90 -0
  57. package/dist/pages/head.d.mts +2 -0
  58. package/dist/pages/head.mjs +112 -0
  59. package/dist/pages/index.d.mts +38 -0
  60. package/dist/pages/index.mjs +76 -0
  61. package/dist/pages/islands-plugin.d.mts +50 -0
  62. package/dist/pages/islands-plugin.mjs +195 -0
  63. package/dist/pages/prefetch.d.mts +31 -0
  64. package/dist/pages/prefetch.mjs +90 -0
  65. package/dist/pages/protocol.d.mts +3 -0
  66. package/dist/pages/protocol.mjs +193 -0
  67. package/dist/pages/serialize.d.mts +10 -0
  68. package/dist/pages/serialize.mjs +14 -0
  69. package/dist/pathe.M-eThtNZ-D-kmWkCS.mjs +150 -0
  70. package/dist/plugin-inference-oZ6Ybu2_.mjs +2447 -0
  71. package/dist/prepare-BAtWufvm.mjs +99 -0
  72. package/dist/preset-D4I73kT4.mjs +221 -0
  73. package/dist/project-TqORyHn8.mjs +72 -0
  74. package/dist/project-cmd-B7lQp3F3.mjs +67 -0
  75. package/dist/project-slug-CKam8lF9.mjs +11 -0
  76. package/dist/project-tsconfig-DfkESbDL.mjs +63 -0
  77. package/dist/protocol-BWzXs2A2.d.mts +34 -0
  78. package/dist/providers-B3aMxWzP.mjs +67 -0
  79. package/dist/resolve-project-Br5BR03U.mjs +29 -0
  80. package/dist/rollback-gyC59l7U.mjs +92 -0
  81. package/dist/route-types-DReF1gUY.mjs +255 -0
  82. package/dist/routes-stub.d.mts +55 -0
  83. package/dist/routes-stub.mjs +1 -0
  84. package/dist/runner-6Ep3fNQu.mjs +123 -0
  85. package/dist/runner-pg-D0wWHYnr.mjs +57 -0
  86. package/dist/runtime/ai.d.mts +127 -0
  87. package/dist/runtime/ai.mjs +348 -0
  88. package/dist/runtime/auth-client-react.d.mts +8 -0
  89. package/dist/runtime/auth-client-react.mjs +6 -0
  90. package/dist/runtime/auth-client-solid.d.mts +8 -0
  91. package/dist/runtime/auth-client-solid.mjs +6 -0
  92. package/dist/runtime/auth-client-svelte.d.mts +8 -0
  93. package/dist/runtime/auth-client-svelte.mjs +6 -0
  94. package/dist/runtime/auth-client-vue.d.mts +8 -0
  95. package/dist/runtime/auth-client-vue.mjs +6 -0
  96. package/dist/runtime/auth-client.d.mts +8 -0
  97. package/dist/runtime/auth-client.mjs +6 -0
  98. package/dist/runtime/auth.d.mts +2 -0
  99. package/dist/runtime/auth.mjs +22 -0
  100. package/dist/runtime/better-auth-pg.d.mts +11 -0
  101. package/dist/runtime/better-auth-pg.mjs +51 -0
  102. package/dist/runtime/better-auth.d.mts +11 -0
  103. package/dist/runtime/better-auth.mjs +33 -0
  104. package/dist/runtime/client.d.mts +6 -0
  105. package/dist/runtime/client.mjs +5 -0
  106. package/dist/runtime/db-pg.d.mts +2 -0
  107. package/dist/runtime/db-pg.mjs +1 -0
  108. package/dist/runtime/db.d.mts +17 -0
  109. package/dist/runtime/db.mjs +30 -0
  110. package/dist/runtime/drizzle-arktype.d.mts +1 -0
  111. package/dist/runtime/drizzle-arktype.mjs +2 -0
  112. package/dist/runtime/drizzle-valibot.d.mts +1 -0
  113. package/dist/runtime/drizzle-valibot.mjs +2 -0
  114. package/dist/runtime/drizzle-zod.d.mts +1 -0
  115. package/dist/runtime/drizzle-zod.mjs +2 -0
  116. package/dist/runtime/env-helpers.d.mts +2 -0
  117. package/dist/runtime/env-helpers.mjs +173 -0
  118. package/dist/runtime/env-public-client.d.mts +22 -0
  119. package/dist/runtime/env-public-client.mjs +54 -0
  120. package/dist/runtime/env-public.d.mts +143 -0
  121. package/dist/runtime/env-public.mjs +366 -0
  122. package/dist/runtime/env.d.mts +13 -0
  123. package/dist/runtime/env.mjs +51 -0
  124. package/dist/runtime/fetch-stream.d.mts +51 -0
  125. package/dist/runtime/fetch-stream.mjs +81 -0
  126. package/dist/runtime/fetch.d.mts +59 -0
  127. package/dist/runtime/fetch.mjs +18 -0
  128. package/dist/runtime/handler.d.mts +3 -0
  129. package/dist/runtime/handler.mjs +85 -0
  130. package/dist/runtime/isr.d.mts +26 -0
  131. package/dist/runtime/isr.mjs +43 -0
  132. package/dist/runtime/kv.d.mts +48 -0
  133. package/dist/runtime/kv.mjs +106 -0
  134. package/dist/runtime/log.d.mts +24 -0
  135. package/dist/runtime/log.mjs +31 -0
  136. package/dist/runtime/migration-handler-pg.d.mts +6 -0
  137. package/dist/runtime/migration-handler-pg.mjs +85 -0
  138. package/dist/runtime/migration-handler.d.mts +19 -0
  139. package/dist/runtime/migration-handler.mjs +92 -0
  140. package/dist/runtime/queues.d.mts +7 -0
  141. package/dist/runtime/queues.mjs +8 -0
  142. package/dist/runtime/remote/binding-handler.d.mts +15 -0
  143. package/dist/runtime/remote/binding-handler.mjs +208 -0
  144. package/dist/runtime/remote/index.d.mts +8 -0
  145. package/dist/runtime/remote/index.mjs +461 -0
  146. package/dist/runtime/response.d.mts +14 -0
  147. package/dist/runtime/response.mjs +30 -0
  148. package/dist/runtime/sandbox.d.mts +17 -0
  149. package/dist/runtime/sandbox.mjs +19 -0
  150. package/dist/runtime/schema-d1.d.mts +1 -0
  151. package/dist/runtime/schema-d1.mjs +2 -0
  152. package/dist/runtime/schema-pg.d.mts +1 -0
  153. package/dist/runtime/schema-pg.mjs +2 -0
  154. package/dist/runtime/seed.d.mts +30 -0
  155. package/dist/runtime/seed.mjs +6 -0
  156. package/dist/runtime/storage.d.mts +7 -0
  157. package/dist/runtime/storage.mjs +14 -0
  158. package/dist/runtime/validator.d.mts +2 -0
  159. package/dist/runtime/validator.mjs +72 -0
  160. package/dist/runtime/ws-server.d.mts +26 -0
  161. package/dist/runtime/ws-server.mjs +296 -0
  162. package/dist/runtime/ws.d.mts +123 -0
  163. package/dist/runtime/ws.mjs +103 -0
  164. package/dist/scan-Ba4hFwlH.mjs +324 -0
  165. package/dist/scan-C6HMEIdW.mjs +318 -0
  166. package/dist/secret-CeRSukgM.mjs +109 -0
  167. package/dist/skills-ipldjlKE.mjs +62 -0
  168. package/dist/standard-schema-9CRjx-uR.d.mts +42 -0
  169. package/dist/subcommand-prompt-BKjuNAPb.mjs +349 -0
  170. package/dist/sveltekit.d.mts +20 -0
  171. package/dist/sveltekit.mjs +61 -0
  172. package/dist/types-mHOEwpW4.d.mts +57 -0
  173. package/dist/validate-CaMavMxu.mjs +146 -0
  174. package/dist/yarn-pnp-BFqMV_bl.mjs +196 -0
  175. package/getting-started-prompt.txt +26 -0
  176. package/package.json +322 -30
  177. package/schema.json +364 -0
  178. package/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
  179. package/skills/void/SKILL.md +75 -0
  180. package/skills/void/command/void.md +7 -0
  181. package/skills/void/docs/guide/ai.md +235 -0
  182. package/skills/void/docs/guide/app-types.md +103 -0
  183. package/skills/void/docs/guide/auth.md +257 -0
  184. package/skills/void/docs/guide/database/d1.md +106 -0
  185. package/skills/void/docs/guide/database/postgresql.md +106 -0
  186. package/skills/void/docs/guide/database.md +418 -0
  187. package/skills/void/docs/guide/deployment.md +98 -0
  188. package/skills/void/docs/guide/edge/headers.md +79 -0
  189. package/skills/void/docs/guide/edge/prerendering.md +83 -0
  190. package/skills/void/docs/guide/edge/redirects.md +116 -0
  191. package/skills/void/docs/guide/edge/revalidation.md +131 -0
  192. package/skills/void/docs/guide/edge/rewrites.md +354 -0
  193. package/skills/void/docs/guide/edge/static-assets.md +72 -0
  194. package/skills/void/docs/guide/env-vars.md +298 -0
  195. package/skills/void/docs/guide/index.md +80 -0
  196. package/skills/void/docs/guide/jobs.md +91 -0
  197. package/skills/void/docs/guide/kv.md +107 -0
  198. package/skills/void/docs/guide/pages-routing/actions-and-forms.md +419 -0
  199. package/skills/void/docs/guide/pages-routing/head.md +130 -0
  200. package/skills/void/docs/guide/pages-routing/islands.md +405 -0
  201. package/skills/void/docs/guide/pages-routing/layouts.md +362 -0
  202. package/skills/void/docs/guide/pages-routing/loaders.md +267 -0
  203. package/skills/void/docs/guide/pages-routing/markdown.md +625 -0
  204. package/skills/void/docs/guide/pages-routing/overview.md +236 -0
  205. package/skills/void/docs/guide/pages-routing/view-transitions.md +140 -0
  206. package/skills/void/docs/guide/queues.md +140 -0
  207. package/skills/void/docs/guide/quickstart.md +233 -0
  208. package/skills/void/docs/guide/remote-dev.md +67 -0
  209. package/skills/void/docs/guide/sandboxes.md +82 -0
  210. package/skills/void/docs/guide/server-routing.md +246 -0
  211. package/skills/void/docs/guide/ssg.md +74 -0
  212. package/skills/void/docs/guide/ssr.md +105 -0
  213. package/skills/void/docs/guide/storage.md +67 -0
  214. package/skills/void/docs/guide/type-safety.md +179 -0
  215. package/skills/void/docs/guide/typed-fetch.md +113 -0
  216. package/skills/void/docs/guide/websockets.md +190 -0
  217. package/skills/void/docs/index.md +48 -0
  218. package/skills/void/docs/integrations/agents.md +84 -0
  219. package/skills/void/docs/integrations/cloudflare.md +284 -0
  220. package/skills/void/docs/integrations/frameworks/analog.md +182 -0
  221. package/skills/void/docs/integrations/frameworks/astro.md +197 -0
  222. package/skills/void/docs/integrations/frameworks/nuxt.md +164 -0
  223. package/skills/void/docs/integrations/frameworks/overview.md +136 -0
  224. package/skills/void/docs/integrations/frameworks/react-router.md +137 -0
  225. package/skills/void/docs/integrations/frameworks/sveltekit.md +191 -0
  226. package/skills/void/docs/integrations/frameworks/tanstack-start.md +140 -0
  227. package/skills/void/docs/integrations/hono.md +97 -0
  228. package/skills/void/docs/integrations/nodejs-bun-deno.md +210 -0
  229. package/skills/void/docs/node_modules/@iconify/vue/README.md +408 -0
  230. package/skills/void/docs/node_modules/@iconify/vue/offline/readme.md +5 -0
  231. package/skills/void/docs/node_modules/@voidzero-dev/vitepress-theme/README.md +103 -0
  232. package/skills/void/docs/node_modules/oxc-minify/README.md +78 -0
  233. package/skills/void/docs/node_modules/reka-ui/README.md +80 -0
  234. package/skills/void/docs/node_modules/vitepress/README.md +28 -0
  235. package/skills/void/docs/node_modules/vitepress/template/api-examples.md +49 -0
  236. package/skills/void/docs/node_modules/vitepress/template/index.md +28 -0
  237. package/skills/void/docs/node_modules/vitepress/template/markdown-examples.md +85 -0
  238. package/skills/void/docs/node_modules/vitepress-plugin-group-icons/README.md +101 -0
  239. package/skills/void/docs/node_modules/void/AGENTS.md +204 -0
  240. package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +15 -0
  241. package/skills/void/docs/node_modules/void/README.md +89 -0
  242. package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +591 -0
  243. package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +375 -0
  244. package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +174 -0
  245. package/skills/void/docs/node_modules/void/node_modules/@cloudflare/vite-plugin/README.md +37 -0
  246. package/skills/void/docs/node_modules/void/node_modules/@cloudflare/workers-types/README.md +135 -0
  247. package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +189 -0
  248. package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/CHANGELOG.md +143 -0
  249. package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/README.md +1272 -0
  250. package/skills/void/docs/node_modules/void/node_modules/@napi-rs/keyring/README.md +19 -0
  251. package/skills/void/docs/node_modules/void/node_modules/@types/better-sqlite3/README.md +15 -0
  252. package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +15 -0
  253. package/skills/void/docs/node_modules/void/node_modules/@types/pg/README.md +15 -0
  254. package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/README.md +22 -0
  255. package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/vendor/vscode-jsonrpc/README.md +69 -0
  256. package/skills/void/docs/node_modules/void/node_modules/@void/md/README.md +152 -0
  257. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/engine-javascript/README.md +9 -0
  258. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/transformers/README.md +9 -0
  259. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +15 -0
  260. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/CHANGELOG.md +24 -0
  261. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/README.md +565 -0
  262. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +124 -0
  263. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-anchor/README.md +600 -0
  264. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +386 -0
  265. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-container/README.md +95 -0
  266. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-emoji/README.md +101 -0
  267. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/pathe/README.md +73 -0
  268. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/shiki/README.md +15 -0
  269. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +25 -0
  270. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tsdown/README.md +55 -0
  271. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/LICENSE.md +2230 -0
  272. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/README.md +20 -0
  273. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vue/README.md +58 -0
  274. package/skills/void/docs/node_modules/void/node_modules/arktype/README.md +165 -0
  275. package/skills/void/docs/node_modules/void/node_modules/better-auth/LICENSE.md +20 -0
  276. package/skills/void/docs/node_modules/void/node_modules/better-auth/README.md +32 -0
  277. package/skills/void/docs/node_modules/void/node_modules/better-sqlite3/README.md +99 -0
  278. package/skills/void/docs/node_modules/void/node_modules/blake3-jit/README.md +108 -0
  279. package/skills/void/docs/node_modules/void/node_modules/drizzle-arktype/README.md +51 -0
  280. package/skills/void/docs/node_modules/void/node_modules/drizzle-kit/README.md +79 -0
  281. package/skills/void/docs/node_modules/void/node_modules/drizzle-orm/README.md +44 -0
  282. package/skills/void/docs/node_modules/void/node_modules/drizzle-valibot/README.md +51 -0
  283. package/skills/void/docs/node_modules/void/node_modules/drizzle-zod/README.md +65 -0
  284. package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +390 -0
  285. package/skills/void/docs/node_modules/void/node_modules/estree-walker/README.md +48 -0
  286. package/skills/void/docs/node_modules/void/node_modules/hono/README.md +85 -0
  287. package/skills/void/docs/node_modules/void/node_modules/ignore/README.md +452 -0
  288. package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/CHANGELOG.md +76 -0
  289. package/{LICENSE β†’ skills/void/docs/node_modules/void/node_modules/jsonc-parser/LICENSE.md} +21 -21
  290. package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/README.md +364 -0
  291. package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/SECURITY.md +41 -0
  292. package/skills/void/docs/node_modules/void/node_modules/magic-string/README.md +325 -0
  293. package/skills/void/docs/node_modules/void/node_modules/ofetch/README.md +398 -0
  294. package/skills/void/docs/node_modules/void/node_modules/pathe/README.md +73 -0
  295. package/skills/void/docs/node_modules/void/node_modules/pg/README.md +95 -0
  296. package/skills/void/docs/node_modules/void/node_modules/pglite-server/LICENSE.md +21 -0
  297. package/skills/void/docs/node_modules/void/node_modules/pglite-server/README.md +135 -0
  298. package/skills/void/docs/node_modules/void/node_modules/picocolors/README.md +21 -0
  299. package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +25 -0
  300. package/skills/void/docs/node_modules/void/node_modules/tsdown/README.md +55 -0
  301. package/skills/void/docs/node_modules/void/node_modules/valibot/LICENSE.md +9 -0
  302. package/skills/void/docs/node_modules/void/node_modules/valibot/README.md +94 -0
  303. package/skills/void/docs/node_modules/void/node_modules/vite/LICENSE.md +2230 -0
  304. package/skills/void/docs/node_modules/void/node_modules/vite/README.md +20 -0
  305. package/skills/void/docs/node_modules/void/node_modules/wrangler/README.md +63 -0
  306. package/skills/void/docs/node_modules/void/node_modules/zod/README.md +191 -0
  307. package/skills/void/docs/node_modules/void/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
  308. package/skills/void/docs/node_modules/void/skills/void/SKILL.md +75 -0
  309. package/skills/void/docs/node_modules/void/skills/void/command/void.md +7 -0
  310. package/skills/void/docs/reference/api.md +917 -0
  311. package/skills/void/docs/reference/cli.md +561 -0
  312. package/skills/void/docs/reference/config.md +408 -0
  313. package/skills/void/docs/reference/resource-inference.md +149 -0
  314. package/skills/void/docs/reference/structure.md +176 -0
  315. package/.npmignore +0 -29
  316. package/.travis.yml +0 -9
  317. package/favicon.ico +0 -0
  318. package/index.js +0 -14
  319. package/lib/Job.js +0 -150
  320. package/lib/Void.js +0 -99
  321. package/lib/scan.js +0 -19
  322. package/test/credentials.js +0 -20
  323. package/test/job.js +0 -64
  324. package/test/static/dir1/test6.html +0 -0
  325. package/test/static/dir2/test7.html +0 -0
  326. package/test/static/dir2/test8.html +0 -0
  327. package/test/static/dir2/test9.html +0 -0
  328. package/test/static/test1.html +0 -0
  329. package/test/static/test2.html +0 -0
  330. package/test/static/test3.html +0 -0
  331. package/test/void.js +0 -31
  332. /package/{test/static/dir1/test4.html β†’ skills/void/docs/integrations/auth-providers.md} +0 -0
  333. /package/{test/static/dir1/test5.html β†’ skills/void/docs/integrations/payment-processors.md} +0 -0
@@ -0,0 +1,600 @@
1
+ # markdown-it-anchor [![npm version](http://img.shields.io/npm/v/markdown-it-anchor.svg?style=flat-square)](https://www.npmjs.org/package/markdown-it-anchor)
2
+
3
+ > A markdown-it plugin that adds an `id` attribute to headings and
4
+ > optionally permalinks.
5
+
6
+ [markdown-it]: https://github.com/markdown-it/markdown-it
7
+
8
+ English | [δΈ­ζ–‡ (v7.0.1)](./README-zh_CN.md)
9
+
10
+ ## Overview
11
+
12
+ This plugin adds an `id` attribute to headings, e.g. `## Foo` becomes
13
+ `<h2 id="foo">Foo</h2>`.
14
+
15
+ Optionally it can also include [permalinks](#permalinks), e.g.
16
+ `<h2 id="foo"><a class="header-anchor" href="#foo">Foo</a></h2>`
17
+ and a bunch of other variants!
18
+
19
+ * [**Usage**](#usage)
20
+ * [User-friendly URLs](#user-friendly-urls)
21
+ * [Manually setting the `id` attribute](#manually-setting-the-id-attribute)
22
+ * [Compatible table of contents plugin](#compatible-table-of-contents-plugin)
23
+ * [Parsing headings from HTML blocks](#parsing-headings-from-html-blocks)
24
+ * [Browser example](#browser-example)
25
+ * [**Permalinks**](#permalinks)
26
+ * [Header link](#header-link)
27
+ * [Link after header](#link-after-header)
28
+ * [Link inside header](#link-inside-header)
29
+ * [ARIA hidden](#aria-hidden)
30
+ * [Custom permalink](#custom-permalink)
31
+ * [Debugging](#debugging)
32
+ * [Development](#development)
33
+
34
+ ## Usage
35
+
36
+ ```js
37
+ const md = require('markdown-it')()
38
+ .use(require('markdown-it-anchor'), opts)
39
+ ```
40
+
41
+ See a [demo as JSFiddle](https://jsfiddle.net/9ukc8dy6/).
42
+
43
+ The `opts` object can contain:
44
+
45
+ | Name | Description | Default |
46
+ |------------------------|---------------------------------------------------------------------------|-----------------------------------------|
47
+ | `level` | Minimum level to apply anchors, or array of selected levels. | 1 |
48
+ | `permalink` | A function to render permalinks, see [permalinks] below. | `undefined` |
49
+ | `slugify` | A custom slugification function. | See [`index.js`][index-slugify] |
50
+ | `callback` | Called with token and info after rendering. | `undefined` |
51
+ | `getTokensText` | A custom function to get the text contents of the title from its tokens. | See [`index.js`][index-get-tokens-text] |
52
+ | `tabIndex` | Value of the `tabindex` attribute on headings, set to `false` to disable. | `-1` |
53
+ | `uniqueSlugStartIndex` | Index to start with when making duplicate slugs unique. | 1 |
54
+
55
+ [index-slugify]: https://github.com/valeriangalliat/markdown-it-anchor/blob/master/index.js#L3
56
+ [index-get-tokens-text]: https://github.com/valeriangalliat/markdown-it-anchor/blob/master/index.js#L5
57
+ [permalinks]: #permalinks
58
+
59
+ All headers greater than the minimum `level` will have an `id` attribute
60
+ with a slug of their content. For example, you can set `level` to 2 to
61
+ add anchors to all headers but `h1`. You can also pass an array of
62
+ header levels to apply the anchor, like `[2, 3]` to have an anchor on
63
+ only level 2 and 3 headers.
64
+
65
+ If a `permalink` renderer is given, it will be called for each matching header
66
+ to add a permalink. See [permalinks] below.
67
+
68
+ If a `slugify` function is given, you can decide how to transform a
69
+ heading text to a URL slug. See [user-friendly URLs](#user-friendly-urls).
70
+
71
+ The `callback` option is a function that will be called at the end of
72
+ rendering with the `token` and an `info` object. The `info` object has
73
+ `title` and `slug` properties with the token content and the slug used
74
+ for the identifier.
75
+
76
+ We set by default [`tabindex="-1"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex)
77
+ on headers. This marks the headers as focusable elements that are not
78
+ reachable by keyboard navigation. The effect is that screen readers will
79
+ read the title content when it's being jumped to. Outside of screen
80
+ readers, the experience is the same as not setting that attribute. You
81
+ can override this behavior with the `tabIndex` option. Set it to `false`
82
+ to remove the attribute altogether, otherwise the value will be used as
83
+ attribute value.
84
+
85
+ Finally, you can customize how the title text is extracted from the
86
+ markdown-it tokens (to later generate the slug). See [user-friendly URLs](#user-friendly-urls).
87
+
88
+ ## User-friendly URLs
89
+
90
+ Starting from v5.0.0, markdown-it-anchor dropped the [`string`](https://github.com/jprichardson/string.js)
91
+ package to retain our core value of being an impartial and secure
92
+ library. Nevertheless, users looking for backward compatibility may want
93
+ the old `slugify` function:
94
+
95
+ ```sh
96
+ npm install string
97
+ ```
98
+
99
+ ```js
100
+ const string = require('string')
101
+ const slugify = s => string(s).slugify().toString()
102
+
103
+ const md = require('markdown-it')()
104
+ .use(require('markdown-it-anchor'), { slugify })
105
+ ```
106
+
107
+ Another popular library for this is [`@sindresorhus/slugify`](https://github.com/sindresorhus/slugify),
108
+ which have better Unicode support and other cool features:
109
+
110
+ ```sh
111
+ npm install @sindresorhus/slugify
112
+ ```
113
+
114
+ ```js
115
+ const slugify = require('@sindresorhus/slugify')
116
+
117
+ const md = require('markdown-it')()
118
+ .use(require('markdown-it-anchor'), { slugify: s => slugify(s) })
119
+ ```
120
+
121
+ ### Custimizing the slugify input
122
+
123
+ Additionally, if you want to further customize the title that gets
124
+ passed to the `slugify` function, you can do so by customizing the
125
+ `getTokensText` function, that gets the plain text from a list of
126
+ markdown-it inline tokens:
127
+
128
+ ```js
129
+ function getTokensText (tokens) {
130
+ return tokens
131
+ .filter(token => !['html_inline', 'image'].includes(token.type))
132
+ .map(t => t.content)
133
+ .join('')
134
+ }
135
+
136
+ const md = require('markdown-it')()
137
+ .use(require('markdown-it-anchor'), { getTokensText })
138
+ ```
139
+
140
+ By default we include only `text` and `code_inline` tokens, which
141
+ appeared to be a sensible approach for the vast majority of use cases.
142
+
143
+ An alternative approach is to include every token's content except for
144
+ `html_inline` and `image` tokens, which yields the exact same results as
145
+ the previous approach with a stock markdown-it, but would also include
146
+ custom tokens added by any of your markdown-it plugins, which might or
147
+ might not be desirable for you. Now you have the option!
148
+
149
+ ### Slugifying with state
150
+
151
+ If you need access to the markdown-it state from the slugify function,
152
+ e.g. to access `state.env`, you can use `slugifyWithState` instead.
153
+
154
+ ```js
155
+ const md = require('markdown-it')()
156
+ .use(require('markdown-it-anchor'), {
157
+ slugifyWithState: (title, state) => `${state.env.id}-${slugify(title)}`
158
+ })
159
+ ```
160
+
161
+ ## Manually setting the `id` attribute
162
+
163
+ You might want to explicitly set the `id` attribute of your headings
164
+ from the Markdown document, for example to keep them consistent across
165
+ translations.
166
+
167
+ markdown-it-anchor is designed to reuse any existing `id`, making [markdown-it-attrs](https://www.npmjs.com/package/markdown-it-attrs)
168
+ a perfect fit for this use case. Make sure to load it before markdown-it-anchor!
169
+
170
+ Then you can do something like this:
171
+
172
+ ```markdown
173
+ # Your title {#your-custom-id}
174
+ ```
175
+
176
+ The anchor link will reuse the `id` that you explicitly defined.
177
+
178
+ ## Compatible table of contents plugin
179
+
180
+ Looking for an automatic table of contents (TOC) generator? Take a look at
181
+ [markdown-it-toc-done-right](https://www.npmjs.com/package/markdown-it-toc-done-right)
182
+ it's made from the ground to be a great companion of this plugin.
183
+
184
+ ## Parsing headings from HTML blocks
185
+
186
+ markdown-it-anchor doesn't parse HTML blocks, so headings defined in
187
+ HTML blocks will be ignored. If you need to add anchors to both HTML
188
+ headings and Markdown headings, the easiest way would be to do it on the
189
+ final HTML rather than during the Markdown parsing phase:
190
+
191
+ ```js
192
+ const { parse } = require('node-html-parser')
193
+
194
+ const root = parse(html)
195
+
196
+ for (const h of root.querySelectorAll('h1, h2, h3, h4, h5, h6')) {
197
+ const slug = h.getAttribute('id') || slugify(h.textContent)
198
+ h.setAttribute('id', slug)
199
+ h.innerHTML = `<a href="#${slug}">${h.innerHTML}</a>`
200
+ }
201
+
202
+ console.log(root.toString())
203
+ ```
204
+
205
+ Or with a (not accessible) GitHub-style anchor, replace the
206
+ `h.innerHTML` part with:
207
+
208
+ ```js
209
+ h.insertAdjacentHTML('afterbegin', `<a class="anchor" aria-hidden="true" href="#${slug}">πŸ”—</a> `)
210
+ ```
211
+
212
+ While this still needs extra work like handling duplicated slugs and
213
+ IDs, this should give you a solid base.
214
+
215
+ That said if you really want to use markdown-it-anchor for this even
216
+ though it's not designed to, you can do like npm does with their
217
+ [marky-markdown](https://github.com/npm/marky-markdown) parser, and
218
+ [transform the `html_block` tokens](https://github.com/npm/marky-markdown/blob/master/lib/plugin/html-heading.js)
219
+ into a sequence of `heading_open`, `inline`, and `heading_close` tokens
220
+ that can be handled by markdown-it-anchor:
221
+
222
+ ```js
223
+ const md = require('markdown-it')()
224
+ .use(require('@npmcorp/marky-markdown/lib/plugin/html-heading'))
225
+ .use(require('markdown-it-anchor'), opts)
226
+ ```
227
+
228
+ While they use regexes to parse the HTML and it won't gracefully handle
229
+ any arbitrary HTML, it should work okay for the happy path, which might
230
+ be good enough for you.
231
+
232
+ You might also want to check [this implementation](https://github.com/valeriangalliat/markdown-it-anchor/issues/105#issuecomment-907323858)
233
+ which uses [Cheerio](https://www.npmjs.com/package/cheerio) for a more
234
+ solid parsing, including support for HTML attributes.
235
+
236
+ The only edge cases I see it failing with are multiple headings defined
237
+ in the same HTML block with arbitrary content between them, or headings
238
+ where the opening and closing tag are defined in separate `html_block`
239
+ tokens, both which should very rarely happen.
240
+
241
+ If you need a bulletproof implementation, I would recommend the first
242
+ HTML parser approach I documented instead.
243
+
244
+ ## Browser example
245
+
246
+ See [`example.html`](example.html).
247
+
248
+ ## Permalinks
249
+
250
+ Version 8.0.0 completely reworked the way permalinks work in order to
251
+ offer more accessible options out of the box. You can also [make your own permalink](#custom-permalink).
252
+
253
+ Instead of a single default way of rendering permalinks (which used to
254
+ have a poor UX on screen readers), we now have multiple styles of
255
+ permalinks for you to chose from.
256
+
257
+ ```js
258
+ const anchor = require('markdown-it-anchor')
259
+ const md = require('markdown-it')()
260
+
261
+ md.use(anchor, {
262
+ permalink: anchor.permalink[styleOfPermalink](permalinkOpts)
263
+ })
264
+ ```
265
+
266
+ Here, `styleOfPermalink` is one of the available styles documented
267
+ below, and `permalinkOpts` is an options object.
268
+
269
+ <div id="common-options"></div>
270
+
271
+ All renderers share a common set of options:
272
+
273
+ | Name | Description | Default |
274
+ |---------------|---------------------------------------------------|------------------------------------|
275
+ | `class` | The class of the permalink anchor. | `header-anchor` |
276
+ | `symbol` | The symbol in the permalink anchor. | `#` |
277
+ | `renderHref` | A custom permalink `href` rendering function. | See [`permalink.js`](permalink.js) |
278
+ | `renderAttrs` | A custom permalink attributes rendering function. | See [`permalink.js`](permalink.js) |
279
+
280
+ For the `symbol`, you may want to use the [link symbol](http://graphemica.com/πŸ”—),
281
+ or a symbol from your favorite web font.
282
+
283
+ ### Header link
284
+
285
+ This style wraps the header itself in an anchor link. It doesn't use the
286
+ `symbol` option as there's no symbol needed in the markup (though you
287
+ could add it with CSS using `::before` if you like).
288
+
289
+ It's so simple it doesn't have any behaviour to custom, and it's also
290
+ accessible out of the box without any further configuration, hence it
291
+ doesn't have other options than the common ones described above.
292
+
293
+ You can find this style on the [MDN] as well as [HTTP Archive] and their
294
+ [Web Almanac], which to me is a good sign that this is a thoughtful way of
295
+ implementing permalinks. This is also the style that I chose for my own
296
+ [blog].
297
+
298
+ [MDN]: https://developer.mozilla.org/en-US/docs/Web
299
+ [HTTP Archive]: https://httparchive.org/reports/state-of-the-web
300
+ [Web Almanac]: https://almanac.httparchive.org/en/2020/table-of-contents
301
+ [blog]: https://www.codejam.info/
302
+
303
+
304
+ | Name | Description | Default |
305
+ |-------------------|-----------------------------------------------------------------------|---------------------------------------|
306
+ | `safariReaderFix` | Add a `span` inside the link so Safari shows headings in reader view. | `false` (for backwards compatibility) |
307
+ | | See [common options](#common-options). | |
308
+
309
+ ```js
310
+ const anchor = require('markdown-it-anchor')
311
+ const md = require('markdown-it')()
312
+
313
+ md.use(anchor, {
314
+ permalink: anchor.permalink.headerLink()
315
+ })
316
+ ```
317
+
318
+ ```html
319
+ <h2 id="title"><a class="header-anchor" href="#title">Title</a></h2>
320
+ ```
321
+
322
+ The main caveat of this approach is that you can't include links inside
323
+ headers. If you do, consider the other styles.
324
+
325
+ Also note that this pattern [breaks reader mode in Safari](https://www.leereamsnyder.com/blog/making-headings-with-links-show-up-in-safari-reader),
326
+ an issue you can also notice on the referenced websites above. This was
327
+ already [reported to Apple](https://bugs.webkit.org/show_bug.cgi?id=225609#c2)
328
+ but their bug tracker is not public. In the meantime, a fix mentioned in
329
+ the article above is to insert a `span` inside the link. You can use the
330
+ `safariReaderFix` option to enable it.
331
+
332
+ ```js
333
+ const anchor = require('markdown-it-anchor')
334
+ const md = require('markdown-it')()
335
+
336
+ md.use(anchor, {
337
+ permalink: anchor.permalink.headerLink({ safariReaderFix: true })
338
+ })
339
+ ```
340
+
341
+ ```html
342
+ <h2 id="title"><a class="header-anchor" href="#title"><span>Title</span></a></h2>
343
+ ```
344
+
345
+ ### Link after header
346
+
347
+ If you want to customize further the screen reader experience of your
348
+ permalinks, this style gives you much more freedom than the [header link](#header-link).
349
+
350
+ It works by leaving the header itself alone, and adding the permalink
351
+ *after* it, giving you different methods of customizing the assistive
352
+ text. It makes the permalink symbol `aria-hidden` to not pollute the
353
+ experience, and leverages a `visuallyHiddenClass` to hide the assistive
354
+ text from the visual experience.
355
+
356
+ | Name | Description | Default |
357
+ |-----------------------|-----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
358
+ | `style` | The (sub) style of link, one of `visually-hidden`, `aria-label`, `aria-describedby` or `aria-labelledby`. | `visually-hidden` |
359
+ | `assistiveText` | A function that takes the title and returns the assistive text. | `undefined`, required for `visually-hidden` and `aria-label` styles |
360
+ | `visuallyHiddenClass` | The class you use to make an element visually hidden. | `undefined`, required for `visually-hidden` style |
361
+ | `space` | Add a space between the assistive text and the permalink symbol. | `true` |
362
+ | `placement` | Placement of the permalink symbol relative to the assistive text, can be `before` or `after` the header. | `after` |
363
+ | `wrapper` | Opening and closing wrapper string, e.g. `['<div class="wrapper">', '</div>']`. | `null` |
364
+ | | See [common options](#common-options). | |
365
+
366
+ ```js
367
+ const anchor = require('markdown-it-anchor')
368
+ const md = require('markdown-it')()
369
+
370
+ md.use(anchor, {
371
+ permalink: anchor.permalink.linkAfterHeader({
372
+ style: 'visually-hidden',
373
+ assistiveText: title => `Permalink to β€œ${title}”`,
374
+ visuallyHiddenClass: 'visually-hidden',
375
+ wrapper: ['<div class="wrapper">', '</div>']
376
+ })
377
+ })
378
+ ```
379
+
380
+ ```html
381
+ <div class="wrapper">
382
+ <h2 id="title">Title</h2>
383
+ <a class="header-anchor" href="#title">
384
+ <span class="visually-hidden">Permalink to β€œTitle”</span>
385
+ <span aria-hidden="true">#</span>
386
+ </a>
387
+ </div>
388
+ ```
389
+
390
+ By using a visually hidden element for the assistive text, we make sure
391
+ that the assistive text can be picked up by translation services, as
392
+ most of the popular translation services (including Google Translate)
393
+ currently ignore `aria-label`.
394
+
395
+ If you prefer an alternative method for the assistive text, see other
396
+ styles:
397
+
398
+ <details>
399
+ <summary><code>aria-label</code> variant</summary>
400
+
401
+ This removes the need from a visually hidden `span`, but will likely
402
+ hurt the permalink experience when using a screen reader through a
403
+ translation service.
404
+
405
+ ```js
406
+ const anchor = require('markdown-it-anchor')
407
+ const md = require('markdown-it')()
408
+
409
+ md.use(anchor, {
410
+ permalink: anchor.permalink.linkAfterHeader({
411
+ style: 'aria-label'
412
+ assistiveText: title => `Permalink to β€œ${title}”`
413
+ })
414
+ })
415
+ ```
416
+
417
+ ```html
418
+ <h2 id="title">Title</h2>
419
+ <a class="header-anchor" href="#title" aria-label="Permalink to β€œTitle”">#</a>
420
+ ```
421
+
422
+ </details>
423
+
424
+ <details>
425
+ <summary><code>aria-describedby</code> and <code>aria-labelledby</code> variants</summary>
426
+
427
+ This removes the need to customize the assistive text to your locale and
428
+ doesn't need a visually hidden `span` either, but since the anchor will
429
+ be described by just the text of the title without any context, it might
430
+ be confusing.
431
+
432
+ ```js
433
+ const anchor = require('markdown-it-anchor')
434
+ const md = require('markdown-it')()
435
+
436
+ md.use(anchor, {
437
+ permalink: anchor.permalink.linkAfterHeader({
438
+ style: 'aria-describedby' // Or `aria-labelledby`
439
+ })
440
+ })
441
+ ```
442
+
443
+ ```html
444
+ <h2 id="title">Title</h2>
445
+ <a class="header-anchor" href="#title" aria-describedby="title">#</a>
446
+ ```
447
+
448
+ </details>
449
+
450
+ ### Link inside header
451
+
452
+ This is the equivalent of the default permalink in previous versions.
453
+ The reason it's not the first one in the list is because this method has
454
+ accessibility issues.
455
+
456
+ If you use a symbol like just `#` without adding any markup around,
457
+ screen readers will read it as part of every heading (in the case of
458
+ `#`, it could be read "pound", "number" or "number sign") meaning that
459
+ if you title is "my beautiful title", it will read "number sign my
460
+ beautiful title" for example. For other common symbols, `πŸ”—` is usually
461
+ read as "link symbol" and `ΒΆ` as "pilcrow".
462
+
463
+ Additionally, screen readers users commonly request the list of all
464
+ links in the page, so they'll be flooded with "number sign, number sign,
465
+ number sign" for each of your headings.
466
+
467
+ I would highly recommend using one of the markups above which have a
468
+ better experience, but if you really want to use this markup, make sure
469
+ to pass accessible HTML as `symbol` to make things usable, like in the
470
+ example below, but even that has some flaws.
471
+
472
+ With that said, this permalink allows the following options:
473
+
474
+ | Name | Description | Default |
475
+ |--------------|--------------------------------------------------------------------------------------------------------------------------|---------|
476
+ | `space` | Add a space between the header text and the permalink symbol. Set it to a string to customize the space (e.g. `&nbsp;`). | `true` |
477
+ | `placement` | Placement of the permalink, can be `before` or `after` the header. This option used to be called `permalinkBefore`. | `after` |
478
+ | `ariaHidden` | Whether to add `aria-hidden="true"`, see [ARIA hidden](#aria-hidden). | `false` |
479
+ | | See [common options](#common-options). | |
480
+
481
+ ```js
482
+ const anchor = require('markdown-it-anchor')
483
+ const md = require('markdown-it')()
484
+
485
+ md.use(anchor, {
486
+ permalink: anchor.permalink.linkInsideHeader({
487
+ symbol: `
488
+ <span class="visually-hidden">Jump to heading</span>
489
+ <span aria-hidden="true">#</span>
490
+ `,
491
+ placement: 'before'
492
+ })
493
+ })
494
+ ```
495
+
496
+ ```html
497
+ <h2 id="title">
498
+ <a class="header-anchor" href="#title">
499
+ <span class="visually-hidden">Jump to heading</span>
500
+ <span aria-hidden="true">#</span>
501
+ </a>
502
+ Title
503
+ </h2>
504
+ ```
505
+
506
+ While this example allows more accessible anchors with the same markup
507
+ as previous versions of markdown-it-anchor, it's still not ideal. The
508
+ assistive text for permalinks will be read as part of the heading when
509
+ listing all the titles of the page, e.g. "jump to heading title 1, jump
510
+ to heading title 2" and so on. Also that assistive text is not very
511
+ useful when listing the links in the page (which will read "jump to
512
+ heading, jump to heading, jump to heading" for each of your permalinks).
513
+
514
+ ### ARIA hidden
515
+
516
+ This is just an alias for [`linkInsideHeader`](#link-inside-header) with
517
+ `ariaHidden: true` by default, to mimic GitHub's way of rendering
518
+ permalinks.
519
+
520
+ Setting `aria-hidden="true"` makes the permalink explicitly inaccessible
521
+ instead of having the permalink and its symbol being read by screen
522
+ readers as part of every single headings (which was a pretty terrible
523
+ experience).
524
+
525
+ ```js
526
+ const anchor = require('markdown-it-anchor')
527
+ const md = require('markdown-it')()
528
+
529
+ md.use(anchor, {
530
+ permalink: anchor.permalink.ariaHidden({
531
+ placement: 'before'
532
+ })
533
+ })
534
+ ```
535
+
536
+ ```html
537
+ <h2 id="title"><a class="header-anchor" href="#title" aria-hidden="true">#</a> Title</h2>
538
+ ```
539
+
540
+ While no experience might be arguably better than a bad experience, I
541
+ would instead recommend using one of the above renderers to provide an
542
+ accessible experience. My favorite one is the [header link](#header-link),
543
+ which is also the simplest one.
544
+
545
+ ### Custom permalink
546
+
547
+ If none of those options suit you, you can always make your own
548
+ renderer! Take inspiration from [the code behind all permalinks](permalink.js).
549
+
550
+ The signature of the function you pass in the `permalink` option is the
551
+ following:
552
+
553
+ ```js
554
+ function renderPermalink (slug, opts, state, idx) {}
555
+ ```
556
+
557
+ Where `opts` are the markdown-it-anchor options, `state` is a
558
+ markdown-it [`StateCore`](https://github.com/markdown-it/markdown-it)
559
+ instance, and `idx` is the index of the `heading_open` token in the
560
+ `state.tokens` array. That array contains [`Token`](https://markdown-it.github.io/markdown-it/#Token)
561
+ objects.
562
+
563
+ To make sense of the "token stream" and the way token objects are
564
+ organized, you will probably want to read the [markdown-it design principles](https://github.com/markdown-it/markdown-it/blob/master/docs/architecture.md)
565
+ page.
566
+
567
+ This function can freely modify the token stream (`state.tokens`),
568
+ usually around the given `idx`, to construct the anchor.
569
+
570
+ Because of the way the token stream works, a `heading_open` token is
571
+ usually followed by a `inline` token that contains the actual text (and
572
+ inline markup) of the heading, and finally a `heading_close` token. This
573
+ is why you'll see most built-in permalink renderers touch
574
+ `state.tokens[idx + 1]`, because they update the contents of the
575
+ `inline` token that follows a `heading_open`.
576
+
577
+ ## Debugging
578
+
579
+ If you want to debug this library more easily, we support source maps.
580
+
581
+ Use the [source-map-support](https://www.npmjs.com/package/source-map-support)
582
+ module to enable it with Node.js.
583
+
584
+ ```sh
585
+ node -r source-map-support/register your-script.js
586
+ ```
587
+
588
+ ## Development
589
+
590
+ ```sh
591
+ # Build the library in the `dist/` directory.
592
+ npm run build
593
+
594
+ # Watch file changes to update `dist/`.
595
+ npm run dev
596
+
597
+ # Run tests, will use the build version so make sure to build after
598
+ # making changes.
599
+ npm test
600
+ ```