Skip to content

Commit 41be5a3

Browse files
chore: textlintを導入 (#83)
Signed-off-by: Shunsuke Kimura <[email protected]> Co-authored-by: Shunsuke KIMURA <[email protected]>
1 parent e4a7a50 commit 41be5a3

37 files changed

+365
-252
lines changed

.github/workflows/deploy.yml

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,66 @@
1-
# Based on ripgrep's release action:
2-
# https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/release.yml
3-
41
name: CI/CD for Documentation
5-
on: [push, pull_request]
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
610
permissions:
711
contents: write
12+
813
jobs:
914
build-and-deploy:
10-
name: build-and-deploy
11-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-24.04
1216
steps:
13-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1418
- uses: dtolnay/rust-toolchain@master
1519
with:
16-
toolchain: '1.77'
20+
toolchain: "1.77"
1721
- uses: Swatinem/rust-cache@v2
1822
- uses: jdx/mise-action@v2
1923
- run: uv sync --locked
2024
- run: mise run generate-docs
2125
- run: mise run generate-web
22-
# deploy ./dist to https://github.com/typst-doc-cn/typst-doc-cn.github.io
26+
- name: Upload build artifacts
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: build-artifacts
30+
path: dist
2331
- name: Deploy
2432
if: github.ref == 'refs/heads/main'
2533
uses: JamesIves/github-pages-deploy-action@v4
2634
with:
2735
folder: dist # The folder the action should deploy.
36+
37+
textlint-md:
38+
runs-on: ubuntu-24.04
39+
steps:
40+
- name: Checkout the repository
41+
uses: actions/checkout@v4
42+
- name: Setup tools
43+
uses: jdx/mise-action@v2
44+
- name: Install dependencies
45+
run: bun install --frozen-lockfile
46+
- name: Lint Markdown using textlint
47+
run: bun run --bun textlint-md
48+
continue-on-error: true
49+
50+
textlint-html:
51+
runs-on: ubuntu-24.04
52+
needs: build-and-deploy
53+
steps:
54+
- name: Checkout the repository
55+
uses: actions/checkout@v4
56+
- name: Download build artifacts
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: build-artifacts
60+
path: dist
61+
- uses: jdx/mise-action@v2
62+
- name: Install dependencies
63+
run: bun install --frozen-lockfile
64+
- name: Lint HTML using textlint
65+
run: bun run --bun textlint-html
66+
continue-on-error: true

.mise.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[tools]
22
# python is managed by .python-version
33
uv = "0.5.1"
4+
node = "22.11.0"
5+
bun = "1.1.37"
46

57
[env]
68
_.python.venv = { path = ".venv", create = true }

.textlintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# hayagrivaのsrc/csl/archive.rsで管理されている参考文献フォーマット
2+
dist/docs/reference/model/bibliography/index.html
3+
dist/docs/reference/model/cite/index.html

.textlintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// @ts-check
2+
3+
/** @type {import("@textlint/config-loader").TextlintConfigDescriptor} */
4+
module.exports = {
5+
plugins: ["html"],
6+
filters: {
7+
comments: true,
8+
},
9+
rules: {
10+
"preset-jtf-style": {
11+
// 階層構造を表現する記号としての>の使用例があるため
12+
"4.3.7.山かっこ<>": false,
13+
},
14+
},
15+
};

bun.lockb

102 KB
Binary file not shown.

docs/changelog/0.1.0.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ description: Changes in Typst 0.1.0
2525
gives access to the automatically resolved kind, supplement, and counter
2626

2727
## Bibliography improvements
28-
- The [`bibliography`] now also accepts multiple bibliography paths (as an
28+
- The [`bibliography`]($bibliography) now also accepts multiple bibliography paths (as an
2929
array)
3030
- Parsing of BibLaTeX files is now more permissive (accepts non-numeric edition,
3131
pages, volumes, dates, and Jabref-style comments; fixed abbreviation parsing)
3232
- Labels and references can now include `:` and `.` except at the end
3333
- Fixed APA bibliography ordering
3434

3535
## Drawing additions
36-
- Added [`polygon`] function for drawing polygons
36+
- Added [`polygon`]($polygon) function for drawing polygons
3737
- Added support for clipping in [boxes]($box.clip) and [blocks]($block.clip)
3838

3939
## Command line interface
@@ -44,12 +44,12 @@ description: Changes in Typst 0.1.0
4444
- Added `--open` flag to directly open the PDF
4545

4646
## Miscellaneous improvements
47-
- Added [`yaml`] function to load data from YAML files
47+
- Added [`yaml`]($yaml) function to load data from YAML files
4848
- Added basic i18n for a few more languages (IT, RU, ZH, FR, PT)
4949
- Added numbering support for Hebrew
5050
- Added support for [integers]($int) with base 2, 8, and 16
5151
- Added symbols for double bracket and laplace operator
52-
- The [`link`] function now accepts [labels]($label)
52+
- The [`link`]($link) function now accepts [labels]($label)
5353
- The link syntax now allows more characters
5454
- Improved justification of Japanese and Chinese text
5555
- Calculation functions behave more consistently w.r.t to non-real results
@@ -63,7 +63,7 @@ description: Changes in Typst 0.1.0
6363
- Fixed invalid parsing of language tag in raw block with a single backtick
6464
- Fixed bugs with displaying counters and state
6565
- Fixed crash related to page counter
66-
- Fixed crash when [`symbol`] function was called without arguments
66+
- Fixed crash when [`symbol`]($symbol) function was called without arguments
6767
- Fixed crash in bibliography generation
6868
- Fixed access to label of certain content elements
6969
- Fixed line number in error message for CSV parsing

docs/changelog/0.10.0.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ description: Changes in Typst 0.10.0
5353
- Changed default [figure supplement]($figure.supplement) for Russian to short
5454
form
5555
- Fixed [CJK-Latin-spacing]($text.cjk-latin-spacing) before line breaks and in
56-
[`locate`] calls
56+
[`locate`]($locate) calls
5757
- Fixed line breaking at the end of links
5858

5959
## Math
@@ -67,13 +67,13 @@ description: Changes in Typst 0.10.0
6767
## Scripting
6868
- Any non-identifier dictionary key is now interpreted as an expression: For
6969
instance, `{((key): value)}` will create a dictionary with a dynamic key
70-
- The [`stroke`] type now has a constructor that converts a value to a stroke or
70+
- The [`stroke`]($stroke) type now has a constructor that converts a value to a stroke or
7171
creates one from its parts
72-
- Added constructor for [`arguments`] type
72+
- Added constructor for [`arguments`]($arguments) type
7373
- Added [`calc.div-euclid`]($calc.div-euclid) and
7474
[`calc.rem-euclid`]($calc.rem-euclid) functions
75-
- Fixed equality of [`arguments`]
76-
- Fixed [`repr`]of [`cmyk`]($color.cmyk) colors
75+
- Fixed equality of [`arguments`]($arguments)
76+
- Fixed [`repr`]($repr) of [`cmyk`]($color.cmyk) colors
7777
- Fixed crashes with provided elements like figure captions, outline entries,
7878
and footnote entries
7979

@@ -115,10 +115,10 @@ description: Changes in Typst 0.10.0
115115
just a string
116116
- The [`number-align`]($enum.number-align) parameter on numbered lists now also
117117
accepts vertical alignments
118-
- Fixed selectors on [quote] elements
118+
- Fixed selectors on [quote]($quote) elements
119119
- Fixed parsing of `[#return]` expression in markup
120120
- Fixed bug where inline equations were displayed in equation outlines
121-
- Fixed potential CRLF issue in [`raw`] blocks
121+
- Fixed potential CRLF issue in [`raw`]($raw) blocks
122122
- Fixed a bug where Chinese numbering couldn't exceed the number 255
123123

124124
## Development

docs/changelog/0.11.0.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ description: Changes in Typst 0.11.0
88
## Tables
99
- Tables are now _much_ more flexible, read the new
1010
[table guide]($guides/table-guide) to get started
11-
- Added [`table.cell`] element for per-cell configuration
11+
- Added [`table.cell`]($table.cell) element for per-cell configuration
1212
- Cells can now span multiple [columns]($table.cell.colspan) or
1313
[rows]($table.cell.rowspan)
1414
- The [stroke]($table.cell.stroke) of individual cells can now be customized
1515
- The [`align`]($table.align) and [`inset`]($table.inset) arguments of the table
1616
function now also take `{(x, y) => ..}` functions
17-
- Added [`table.hline`] and [`table.vline`] for convenient line customization
18-
- Added [`table.header`] element for table headers that repeat on every page
19-
- Added [`table.footer`] element for table footers that repeat on every page
17+
- Added [`table.hline`]($table.hline) and [`table.vline`]($table.vline) for convenient line customization
18+
- Added [`table.header`]($table.header) element for table headers that repeat on every page
19+
- Added [`table.footer`]($table.footer) element for table footers that repeat on every page
2020
- All the new table functionality is also available for [grids]($grid)
2121
- Fixed gutter-related bugs
2222

@@ -40,32 +40,32 @@ _Thanks to [@PgBiel](https://github.com/PgBiel) for his work on tables!_
4040
[disciplines](https://github.com/typst/packages/blob/main/DISCIPLINES.md).
4141

4242
## Context
43-
- Added _context expressions:_ Read the chapter on [context] to get started
43+
- Added _context expressions:_ Read the chapter on [context]($context) to get started
4444
- With context, you can access settable properties, e.g. `{context text.lang}`
4545
to access the language set via `{set text(lang: "..")}`
46-
- The following existing functions have been made contextual: [`query`],
47-
[`locate`], [`measure`], [`counter.display`], [`counter.at`],
48-
[`counter.final`], [`state.at`], and [`state.final`]
49-
- Added contextual methods [`counter.get`] and [`state.get`] to retrieve the
46+
- The following existing functions have been made contextual: [`query`]($query),
47+
[`locate`]($locate), [`measure`]($measure), [`counter.display`]($counter.display), [`counter.at`]($counter.at),
48+
[`counter.final`]($counter.final), [`state.at`]($state.at), and [`state.final`]($state.final)
49+
- Added contextual methods [`counter.get`]($counter.get) and [`state.get`]($state.get) to retrieve the
5050
value of a counter or state in the current context
51-
- Added contextual function [`here`] to retrieve the [location] of the current
51+
- Added contextual function [`here`]($here) to retrieve the [location]($location) of the current
5252
context
53-
- The [`locate`] function now returns the location of a selector's unique match.
53+
- The [`locate`]($locate) function now returns the location of a selector's unique match.
5454
Its old behavior has been replaced by context expressions and only remains
5555
temporarily available for compatibility.
56-
- The [`counter.at`] and [`state.at`] methods are now more flexible: They
56+
- The [`counter.at`]($counter.at) and [`state.at`]($state.at) methods are now more flexible: They
5757
directly accept any kind of [locatable]($location/#locatable) selector with a
5858
unique match (e.g. a label) instead of just locations
59-
- When context is available, [`counter.display`] now directly returns the result
59+
- When context is available, [`counter.display`]($counter.display) now directly returns the result
6060
of applying the numbering instead of yielding opaque content. It should not be
6161
used anymore without context. (Deprecation planned)
62-
- The [`state.display`] function should not be used anymore, use [`state.get`]
62+
- The [`state.display`]($state.display) function should not be used anymore, use [`state.get`]($state.get)
6363
instead (Deprecation planned)
64-
- The `location` argument of [`query`], [`counter.final`], and [`state.final`]
64+
- The `location` argument of [`query`]($query), [`counter.final`]($counter.final), and [`state.final`]($state.final)
6565
should not be used anymore (Deprecation planned)
6666
- The [`styles`]($measure.styles) argument of the `measure` function should not
6767
be used anymore (Deprecation planned)
68-
- The [`style`] function should not be used anymore, use context instead
68+
- The [`style`]($style) function should not be used anymore, use context instead
6969
(Deprecation planned)
7070
- The correct context is now also provided in various other places where it is
7171
available, e.g. in show rules, layout callbacks, and numbering functions in
@@ -89,7 +89,7 @@ _Thanks to [@PgBiel](https://github.com/PgBiel) for his work on tables!_
8989
show rules
9090
- Errors within show rules and context expressions are now ignored in all but
9191
the last introspection iteration, in line with the behavior of the old
92-
[`locate`]
92+
[`locate`]($locate)
9393
- Fixed a bug where document set rules were allowed after content
9494

9595
## Layout
@@ -98,9 +98,9 @@ _Thanks to [@PgBiel](https://github.com/PgBiel) for his work on tables!_
9898
- Fixed a bug where [floating placement]($place.float) or
9999
[floating figures]($figure.placement) could end up out of order
100100
- Fixed overlap of text and figure for full-page floating figures
101-
- Fixed various cases where the [`hide`] function didn't hide its contents
101+
- Fixed various cases where the [`hide`]($hide) function didn't hide its contents
102102
properly
103-
- Fixed usage of [`h`] and [`v`] in [stacks]($stack)
103+
- Fixed usage of [`h`]($h) and [`v`]($v) in [stacks]($stack)
104104
- Invisible content like a counter update will no longer force a visible block
105105
for just itself
106106
- Fixed a bug with horizontal spacing followed by invisible content (like a
@@ -109,7 +109,7 @@ _Thanks to [@PgBiel](https://github.com/PgBiel) for his work on tables!_
109109
## Text
110110
- Added [`stroke`]($text.stroke) property for text
111111
- Added basic i18n for Serbian and Catalan
112-
- Added support for contemporary Japanese [numbering] method
112+
- Added support for contemporary Japanese [numbering]($numbering) method
113113
- Added patches for various wrong metadata in specific fonts
114114
- The [text direction]($text.dir) can now be overridden within a paragraph
115115
- Fixed Danish [smart quotes]($smartquote)
@@ -125,9 +125,9 @@ _Thanks to [@PgBiel](https://github.com/PgBiel) for his work on tables!_
125125
heading to increase or decrease the heading level for a bunch of content; the
126126
heading syntax now sets `depth` rather than `level` **(Breaking change)**
127127
- List [markers]($list.marker) now cycle by default
128-
- The [`quote`] function now more robustly selects the correct quotes based on
128+
- The [`quote`]($quote) function now more robustly selects the correct quotes based on
129129
language and nesting
130-
- Fixed indent bugs related to the default show rule of [terms]
130+
- Fixed indent bugs related to the default show rule of [terms]($terms)
131131

132132
## Math
133133
- Inline equations now automatically linebreak at appropriate places
@@ -137,10 +137,10 @@ _Thanks to [@PgBiel](https://github.com/PgBiel) for his work on tables!_
137137
- Improved positioning of accents
138138
- [Primes]($math.primes) are now always attached as [scripts]($math.scripts) by
139139
default
140-
- Exposed [`math.primes`] element which backs the `[$f'$]` syntax in math
141-
- Math mode is not affected by [`strong`] and [`emph`] anymore
140+
- Exposed [`math.primes`]($math.primes) element which backs the `[$f'$]` syntax in math
141+
- Math mode is not affected by [`strong`]($strong) and [`emph`]($emph) anymore
142142
- Fixed [`attach`]($math.attach) under [fractions]($math.frac)
143-
- Fixed that [`math.class`] did not affect smart limit placement
143+
- Fixed that [`math.class`]($math.class) did not affect smart limit placement
144144
- Fixed weak spacing in [`lr`]($math.lr) groups
145145
- Fixed layout of large operators for Cambria Math font
146146
- Fixed math styling of Hebrew symbol codepoints
@@ -161,19 +161,19 @@ _Thanks to [@PgBiel](https://github.com/PgBiel) for his work on tables!_
161161
- Arrays can now be compared lexicographically
162162
- Added contextual method [`to-absolute`]($length.to-absolute) to lengths
163163
- Added [`calc.root`]($calc.root)
164-
- Added [`int.signum`] and [`float.signum`] methods
165-
- Added [`float.is-nan`] and [`float.is-infinite`] methods
166-
- Added [`int.bit-not`], [`int.bit-and`], [`int.bit-or`], [`int.bit-xor`],
167-
[`int.bit-lshift`], and [`int.bit-rshift`] methods
168-
- Added [`array.chunks`] method
164+
- Added [`int.signum`]($int.signum) and [`float.signum`]($float.signum) methods
165+
- Added [`float.is-nan`]($float.is-nan) and [`float.is-infinite`]($float.is-infinite) methods
166+
- Added [`int.bit-not`]($int.bit-not), [`int.bit-and`]($int.bit-and), [`int.bit-or`]($int.bit-or), [`int.bit-xor`]($int.bit-xor),
167+
[`int.bit-lshift`]($int.bit-lshift), and [`int.bit-rshift`]($int.bit-rshift) methods
168+
- Added [`array.chunks`]($array.chunks) method
169169
- A module can now be converted to a dictionary with the
170170
[dictionary constructor]($dictionary/#constructor) to access its contents
171171
dynamically
172172
- Added [`row-type`]($csv.row-type) argument to `csv` function to configure
173173
how rows will be represented
174174
- [XML parsing]($xml) now allows DTDs (document type definitions)
175175
- Improved formatting of negative numbers with [`str`]($str) and [`repr`]($repr)
176-
- For loops can now iterate over [bytes]
176+
- For loops can now iterate over [bytes]($bytes)
177177
- Fixed a bug with pattern matching in for loops
178178
- Fixed a bug with labels not being part of [`{.fields()}`]($content.fields)
179179
dictionaries
@@ -186,7 +186,7 @@ _Thanks to [@PgBiel](https://github.com/PgBiel) for his work on tables!_
186186
instead of being collapsed into normal spaces **(Breaking change)**
187187
- Korean text can now use emphasis syntax without adding spaces
188188
**(Breaking change)**
189-
- The token [`context`] is now a keyword and cannot be used as an identifier
189+
- The token [`context`]($context) is now a keyword and cannot be used as an identifier
190190
anymore **(Breaking change)**
191191
- Nested line comments aren't allowed anymore in block comments
192192
**(Breaking change)**
@@ -197,7 +197,7 @@ _Thanks to [@PgBiel](https://github.com/PgBiel) for his work on tables!_
197197
dictionaries
198198

199199
## Tooling & Diagnostics
200-
- Click-to-jump now works properly within [`raw`] text
200+
- Click-to-jump now works properly within [`raw`]($raw) text
201201
- Added suggestion for accessing a field if a method doesn't exist
202202
- Improved hint for calling a function stored in a dictionary
203203
- Improved errors for mutable accessor functions on arrays and dictionaries
@@ -208,23 +208,23 @@ _Thanks to [@PgBiel](https://github.com/PgBiel) for his work on tables!_
208208
namespaces
209209

210210
## Visualization
211-
- The [`image`] function doesn't upscale images beyond their natural size
211+
- The [`image`]($image) function doesn't upscale images beyond their natural size
212212
anymore
213-
- The [`image`] function now respects rotation stored in EXIF metadata
213+
- The [`image`]($image) function now respects rotation stored in EXIF metadata
214214
- Added support for SVG filters
215215
- Added alpha component to [`luma`]($color.luma) colors
216-
- Added [`color.transparentize`] and [`color.opacify`] methods
217-
- Improved [`color.negate`] function
216+
- Added [`color.transparentize`]($color.transparentize) and [`color.opacify`]($color.opacify) methods
217+
- Improved [`color.negate`]($color.negate) function
218218
- Added [`stroke`]($highlight.stroke) and [`radius`]($highlight.radius)
219219
arguments to `highlight` function
220-
- Changed default [`highlight`] color to be transparent
220+
- Changed default [`highlight`]($highlight) color to be transparent
221221
- CMYK to RGB conversion is now color-managed
222222
- Fixed crash with gradients in Oklch color space
223223
- Fixed color-mixing for hue-based spaces
224224
- Fixed bugs with color conversion
225225
- SVG sizes are not rounded anymore, preventing slightly wrong aspect ratios
226226
- Fixed a few other SVG-related bugs
227-
- [`color.components`] doesn't round anything anymore
227+
- [`color.components`]($color.components) doesn't round anything anymore
228228

229229
## Export
230230
- PDFs now contain named destinations for headings derived from their labels

docs/changelog/0.11.1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ description: Changes in Typst 0.11.1
1818

1919
## Text and Layout
2020
- Fixed interaction of [`first-line-indent`]($par.first-line-indent) and
21-
[`outline`]
21+
[`outline`]($outline)
2222
- Fixed compression of CJK punctuation marks at line start and end
2323
- Fixed handling of [rectangles]($rect) with negative dimensions
24-
- Fixed layout of [`path`] in explicitly sized container
25-
- Fixed broken [`raw`] text in right-to-left paragraphs
24+
- Fixed layout of [`path`]($path) in explicitly sized container
25+
- Fixed broken [`raw`]($raw) text in right-to-left paragraphs
2626
- Fixed tab rendering in `raw` text with language `typ` or `typc`
2727
- Fixed highlighting of multi-line `raw` text enclosed by single backticks
2828
- Fixed indentation of overflowing lines in `raw` blocks

0 commit comments

Comments
 (0)