Skip to content

Commit 368e269

Browse files
committed
docs(usage): add anchor links from method names to section headings 📝
- Link method names in Methods Overview table to corresponding section headings - Link method names in Pick a Method by What You Need table to section headings
1 parent 6984daf commit 368e269

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

USAGE.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,33 @@ const svg = QRCode.toSVG({
4545

4646
## Methods Overview
4747

48-
| Method | Options | Returns | Description |
49-
| :-------------------- | :------------------- | :---------------- | :------------------------------------------------------------------------ |
50-
| `QRCode.toASCII` | FormatOptions | string | Terminal-style block or half-block art. |
51-
| `QRCode.toCanvas` | (ctx, FormatOptions) | void | Draws QR on given 2D context. |
52-
| `QRCode.toDataURL` | FormatOptions | string | `data:image/gif;base64,...`. |
53-
| `QRCode.toFile` | (path, SVGOptions) | Promise\<void\> | Writes SVG to file (or triggers download in browser). |
54-
| `QRCode.toFileStream` | (stream, SVGOptions) | Promise\<void\> | Writes SVG to writable stream. |
55-
| `QRCode.toImgTag` | ImgTagOptions | string | HTML `<img src="data:..." alt="..." />` (GIF, optional alt/width/height). |
56-
| `QRCode.toPath` | QRCodeOptions | PathResult | `{ cellSize, path }` for custom rendering. |
57-
| `QRCode.toPNG` | PNGOptions | Promise\<string\> | `data:image/png;base64,...`; optional color/background. |
58-
| `QRCode.toSVG` | SVGOptions | string | Full SVG with path, fill, defs, optional logo, optional title/alt. |
59-
| `QRCode.toTableTag` | FormatOptions | string | HTML `<table>...</table>`. |
48+
| Method | Options | Returns | Description |
49+
| :--------------------------------------------------- | :------------------- | :---------------- | :------------------------------------------------------------------------ |
50+
| [`QRCode.toASCII`](#toascii-todataurl-totabletag) | FormatOptions | string | Terminal-style block or half-block art. |
51+
| [`QRCode.toCanvas`](#tocanvas) | (ctx, FormatOptions) | void | Draws QR on given 2D context. |
52+
| [`QRCode.toDataURL`](#toascii-todataurl-totabletag) | FormatOptions | string | `data:image/gif;base64,...`. |
53+
| [`QRCode.toFile`](#tofile) | (path, SVGOptions) | Promise\<void\> | Writes SVG to file (or triggers download in browser). |
54+
| [`QRCode.toFileStream`](#tofilestream) | (stream, SVGOptions) | Promise\<void\> | Writes SVG to writable stream. |
55+
| [`QRCode.toImgTag`](#toimgtag) | ImgTagOptions | string | HTML `<img src="data:..." alt="..." />` (GIF, optional alt/width/height). |
56+
| [`QRCode.toPath`](#topath-path-only) | QRCodeOptions | PathResult | `{ cellSize, path }` for custom rendering. |
57+
| [`QRCode.toPNG`](#topng) | PNGOptions | Promise\<string\> | `data:image/png;base64,...`; optional color/background. |
58+
| [`QRCode.toSVG`](#tosvg-full-options) | SVGOptions | string | Full SVG with path, fill, defs, optional logo, optional title/alt. |
59+
| [`QRCode.toTableTag`](#toascii-todataurl-totabletag) | FormatOptions | string | HTML `<table>...</table>`. |
6060

6161
### Pick a Method by What You Need
6262

63-
| I want to… | Use this | Minimal call |
64-
| :------------------------------ | :-------------------- | :---------------------------------------------------------------------- |
65-
| Draw on my own canvas | `QRCode.toCanvas` | `toCanvas(ctx, { value: '…' })` |
66-
| Get an SVG to show or save | `QRCode.toSVG` | `toSVG({ value: '…', size: 400 })` |
67-
| Get GIF for `<img>` or download | `QRCode.toDataURL` | `toDataURL({ value: '…' })` |
68-
| Get HTML img tag (GIF, alt) | `QRCode.toImgTag` | `toImgTag({ value: '…', alt: 'QR code' })` |
69-
| Get HTML table | `QRCode.toTableTag` | `toTableTag({ value: '…' })` |
70-
| Get path string for custom draw | `QRCode.toPath` | `toPath({ value: '…', size: 400 })` |
71-
| Get PNG for `<img>` or download | `QRCode.toPNG` | `await QRCode.toPNG({ value: '…', color: '#000', background: '#fff' })` |
72-
| Print QR in terminal | `QRCode.toASCII` | `toASCII({ value: '…' })` |
73-
| Write SVG to file or download | `QRCode.toFile` | `toFile('out.svg', { value: '…', size: 400 })` |
74-
| Write SVG to a stream | `QRCode.toFileStream` | `toFileStream(stream, { value: '…', size: 400 })` |
63+
| I want to… | Use this | Minimal call |
64+
| :------------------------------ | :--------------------------------------------------- | :---------------------------------------------------------------------- |
65+
| Draw on my own canvas | [`QRCode.toCanvas`](#tocanvas) | `toCanvas(ctx, { value: '…' })` |
66+
| Get an SVG to show or save | [`QRCode.toSVG`](#tosvg-full-options) | `toSVG({ value: '…', size: 400 })` |
67+
| Get GIF for `<img>` or download | [`QRCode.toDataURL`](#toascii-todataurl-totabletag) | `toDataURL({ value: '…' })` |
68+
| Get HTML img tag (GIF, alt) | [`QRCode.toImgTag`](#toimgtag) | `toImgTag({ value: '…', alt: 'QR code' })` |
69+
| Get HTML table | [`QRCode.toTableTag`](#toascii-todataurl-totabletag) | `toTableTag({ value: '…' })` |
70+
| Get path string for custom draw | [`QRCode.toPath`](#topath-path-only) | `toPath({ value: '…', size: 400 })` |
71+
| Get PNG for `<img>` or download | [`QRCode.toPNG`](#topng) | `await QRCode.toPNG({ value: '…', color: '#000', background: '#fff' })` |
72+
| Print QR in terminal | [`QRCode.toASCII`](#toascii-todataurl-totabletag) | `toASCII({ value: '…' })` |
73+
| Write SVG to file or download | [`QRCode.toFile`](#tofile) | `toFile('out.svg', { value: '…', size: 400 })` |
74+
| Write SVG to a stream | [`QRCode.toFileStream`](#tofilestream) | `toFileStream(stream, { value: '…', size: 400 })` |
7575

7676
> [!NOTE]
7777
> Every method needs at least `value` (the text or URL to encode). `toSVG`, `toPath`, `toFile`, and `toFileStream` also need `size` (width/height in pixels). `toASCII`, `toDataURL`, `toImgTag`, `toPNG`, and `toTableTag` use optional `cellSize` and `margin` for dimensions.

0 commit comments

Comments
 (0)