Skip to content

Commit 00f1a4d

Browse files
authored
docs: clean up API documentation (#1763)
1 parent 23c7072 commit 00f1a4d

16 files changed

Lines changed: 15 additions & 222 deletions

File tree

‎AGENTS.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ Docs, specs, and examples are not cleanup work for later. They are part of the f
351351

352352
- Keep README files, package docs, examples, and generated references consistent with the shipped behavior.
353353
- If a change affects public API, behavior, configuration, or generated outputs, update the relevant docs and examples in the same PR.
354-
- Significant breaking changes must add a migration guide under `docs/content/migrate/` (`/migrate` on the docs site). Explain what breaks and how to update existing code or configuration. Usage and reference pages describe the current behavior and link to the guide. Move existing upgrade instructions there rather than deleting them.
354+
- Add migration guides only when explicitly requested. Keep replacement guidance in code deprecation annotations. Usage and reference pages describe the current API.
355355
- Use the `humanizer` skill when writing or editing documentation.
356356

357357
Prefer concrete explanations over marketing language. Show the real API. Keep examples runnable.
@@ -382,9 +382,9 @@ were Zig. Every sentence of it is bloat in a place with a low budget for it.
382382
binding crate's own doc comments, a commit message. `html_span_attrs` in
383383
`lumis_nif` explains the call-frequency split at length, correctly — that is a
384384
contributor's file.
385-
- **Cross-runtime pointers are not this.** "The counterpart of `Language::guess`
386-
in Rust and `guessLanguage()` in JavaScript" helps someone moving between the
387-
packages Lumis publishes, and stays.
385+
- **Keep API references specific to their runtime.** Describe the function
386+
directly; omit comparisons to equivalent functions in other runtimes.
387+
Cross-runtime API mappings belong in contributor documentation.
388388

389389
This applies to every published surface: package docs, READMEs, `usage-rules.md`,
390390
and `docs/content/`. It came out of an ANSI helper module whose moduledoc opened

‎crates/lumis-core/src/formatter/html.rs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,7 @@ pub(crate) fn write_escaped(output: &mut dyn Write, text: &str) -> io::Result<()
571571
/// loaded with [`crate::themes::from_json`]. Neither is a generated constant, so
572572
/// both are escaped here rather than interpolated raw.
573573
///
574-
/// The escape set is the same as [`escape`], which is what `escapeAttr` in
575-
/// `packages/javascript/lumis/src/formatter/html.ts` covers, so the two runtimes
576-
/// answer the same for the same input. Escaping is safe for CSS in an attribute
574+
/// The escape set is the same as [`escape`]. Escaping is safe for CSS in an attribute
577575
/// because the HTML parser decodes the entity before the CSS parser sees it, so
578576
/// `font-family: 'Fira Code'` survives the round trip.
579577
pub fn escape_attr(value: &str) -> String {

‎crates/lumis-core/src/languages.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,6 @@ macro_rules! define_languages {
378378

379379
/// Every compiled-in language and what the catalog knows about it,
380380
/// sorted by id.
381-
///
382-
/// Elixir's `Lumis.Languages.available/0` and JavaScript's
383-
/// `languages.available()` return this same record.
384381
pub fn available_languages() -> Vec<LanguageInfo> {
385382
let mut languages: Vec<LanguageInfo> = Language::iter().map(|l| l.info()).collect();
386383
languages.sort_unstable_by_key(|language| language.id);

‎crates/lumis/src/highlight.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ static DEFAULT_STYLE: LazyLock<Arc<Style>> = LazyLock::new(|| Arc::new(Style::de
105105

106106
/// Options for one highlighting operation.
107107
///
108-
/// The counterpart of the `options` argument to JavaScript's `highlight()` and
109-
/// `highlightEvents()`.
110-
///
111108
/// `'a` is the annotation data's lifetime; `'c` is the cancellation flag's.
112109
/// Returned events borrow only the annotations, so they can outlive the flag.
113110
///

‎docs/content/migrate/api-modules.mdx‎

Lines changed: 0 additions & 148 deletions
This file was deleted.

‎docs/content/migrate/index.mdx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ release numbers, so the guides are grouped by runtime or integration.
88

99
| Existing code | Guide |
1010
| --- | --- |
11-
| JavaScript or Elixir root catalog and parser helpers | [Language and theme modules](/migrate/api-modules) |
12-
| Rust `themes::choose_theme` calls | [Theme matching](/migrate/theme-matching) |
1311
| Elixir 0.6, or parser downloads from before 0.9 | [Elixir upgrades](/migrate/elixir) |
1412
| HTML line divs or helpers that return line terminators | [HTML line markup](/migrate/html-lines) |
1513
| JavaScript-only custom parser and query definitions | [JavaScript custom languages](/migrate/javascript) |

‎docs/content/migrate/meta.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"title": "Migrate",
33
"pages": [
44
"index",
5-
"api-modules",
6-
"theme-matching",
75
"elixir",
86
"html-lines",
97
"javascript",

‎docs/content/migrate/theme-matching.mdx‎

Lines changed: 0 additions & 22 deletions
This file was deleted.

‎docs/content/themes/closest.mdx‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ let theme = themes::closest(&colors);
3535
assert_eq!(theme.map(|theme| theme.name.as_str()), Some("modus_vivendi"));
3636
```
3737

38-
Existing callers of `choose_theme` should follow the
39-
[rename guide](/migrate/theme-matching).
40-
4138
</Tab>
4239
<Tab value="Elixir">
4340

‎docs/content/usage/javascript.mdx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ Useful when rendering user-provided content or pasted snippets.
181181
## Metadata APIs
182182

183183
Language helpers live in `@lumis-sh/lumis/languages`, and theme helpers live in
184-
`@lumis-sh/lumis/themes`. Old root imports still work but are deprecated; see the
185-
[module migration guide](/migrate/api-modules).
184+
`@lumis-sh/lumis/themes`.
186185

187186
Useful for dropdowns, config validation, and docs tooling:
188187

@@ -195,7 +194,7 @@ Useful for dropdowns, config validation, and docs tooling:
195194
## Runtime notes
196195

197196
- every runtime loads the same per-language parser WASM; what differs is the engine that runs it
198-
- on Node, `@lumis-sh/lumis` runs those parsers and the highlighting walk under Wasmtime in the same Rust code as the Lumis CLI and Elixir bindings; built-in formatters normally render there too, while custom formatters assemble events in JavaScript and an async call that may need a JavaScript resolver stays on the main thread
197+
- on Node, `@lumis-sh/lumis` runs those parsers and the highlighting walk under Wasmtime; built-in formatters normally render there too, while custom formatters assemble events in JavaScript and an async call that may need a JavaScript resolver stays on the main thread
199198
- browsers, and any platform with no prebuilt addon, run them under the host's own WebAssembly through `web-tree-sitter`, and walk and format in JavaScript
200199
- the addon is prebuilt for macOS arm64 and x64, Linux arm64 and x64 against both glibc and musl, and Windows arm64 and x64; npm installs the one matching the host, so Alpine and other musl images get the same runtime as a glibc host
201200
- `runtimeKind()` returns `'native'` or `'wasm'` if you need to confirm which one an install resolved

0 commit comments

Comments
 (0)