Skip to content

Commit 7182ad8

Browse files
committed
fix borked newlines in parts of the documentation
1 parent 205c785 commit 7182ad8

File tree

4 files changed

+51
-77
lines changed

4 files changed

+51
-77
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ts-rs-macros"
3-
version = "12.0.0"
3+
version = "12.0.1"
44
authors = ["Moritz Bischof <moritz.bischof1@gmail.com>"]
55
edition = "2021"
66
description = "derive macro for ts-rs"

ts-rs/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ts-rs"
3-
version = "12.0.0"
3+
version = "12.0.1"
44
authors = ["Moritz Bischof <moritz.bischof1@gmail.com>"]
55
edition = "2021"
66
license = "MIT"
@@ -46,7 +46,7 @@ chrono = { version = "0.4", features = ["serde"] }
4646
tokio = { version = "1.40", features = ["sync", "rt"] }
4747

4848
[dependencies]
49-
ts-rs-macros = { version = "=12.0.0", path = "../macros" }
49+
ts-rs-macros = { version = "=12.0.1", path = "../macros" }
5050
thiserror = "2"
5151

5252
heapless = { version = ">= 0.7, < 0.9", optional = true }

ts-rs/src/lib.rs

Lines changed: 46 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ mod tokio;
186186
/// ### container attributes
187187
/// attributes applicable for both structs and enums
188188
///
189-
/// - **`#[ts(crate = "..")]`**
189+
/// - **`#[ts(crate = "..")]`** \
190190
/// Generates code which references the module passed to it instead of defaulting to `::ts_rs`
191191
/// This is useful for cases where you have to re-export the crate.
192192
///
193-
/// - **`#[ts(export)]`**
193+
/// - **`#[ts(export)]`** \
194194
/// Generates a test which will export the type, by default to `bindings/<name>.ts` when running
195195
/// `cargo test`. The default base directory can be overridden with the `TS_RS_EXPORT_DIR` environment variable.
196196
/// Adding the variable to a project's [config.toml](https://doc.rust-lang.org/cargo/reference/config.html#env) can
@@ -200,44 +200,38 @@ mod tokio;
200200
/// [env]
201201
/// TS_RS_EXPORT_DIR = { value = "<OVERRIDE_DIR>", relative = true }
202202
/// ```
203-
/// <br/>
204203
///
205-
/// - **`#[ts(export_to = "..")]`**
204+
/// - **`#[ts(export_to = "..")]`** \
206205
/// Specifies where the type should be exported to. Defaults to `<name>.ts`.
207206
/// The path given to the `export_to` attribute is relative to the `TS_RS_EXPORT_DIR` environment variable,
208207
/// or, if `TS_RS_EXPORT_DIR` is not set, to `./bindings`
209208
/// If the provided path ends in a trailing `/`, it is interpreted as a directory.
210209
/// This attribute also accepts arbitrary expressions.
211210
/// Note that you need to add the `export` attribute as well, in order to generate a test which exports the type.
212-
/// <br/><br/>
213211
///
214-
/// - **`#[ts(as = "..")]`**
215-
/// Overrides the type used in Typescript, using the provided Rust type instead.
212+
/// - **`#[ts(as = "..")]`** \
213+
/// Overrides the type used in Typescript, using the provided Rust type instead. \
216214
/// This is useful when you have a custom serializer and deserializer and don't want to implement `TS` manually
217-
/// <br/><br/>
218215
///
219-
/// - **`#[ts(type = "..")]`**
220-
/// Overrides the type used in TypeScript.
216+
/// - **`#[ts(type = "..")]`** \
217+
/// Overrides the type used in TypeScript. \
221218
/// This is useful when you have a custom serializer and deserializer and don't want to implement `TS` manually
222-
/// <br/><br/>
223219
///
224-
/// - **`#[ts(rename = "..")]`**
225-
/// Sets the typescript name of the generated type.
220+
/// - **`#[ts(rename = "..")]`** \
221+
/// Sets the typescript name of the generated type. \
226222
/// Also accepts expressions, e.g `#[ts(rename = module_path!().rsplit_once("::").unwrap().1)]`.
227-
/// <br/><br/>
228223
///
229-
/// - **`#[ts(rename_all = "..")]`**
230-
/// Rename all fields/variants of the type.
224+
/// - **`#[ts(rename_all = "..")]`** \
225+
/// Rename all fields/variants of the type. \
231226
/// Valid values are `lowercase`, `UPPERCASE`, `camelCase`, `snake_case`, `PascalCase`, `SCREAMING_SNAKE_CASE`, "kebab-case" and "SCREAMING-KEBAB-CASE"
232-
/// <br/><br/>
233227
///
234-
/// - **`#[ts(concrete(..)]`**
235-
/// Disables one ore more generic type parameters by specifying a concrete type for them.
228+
/// - **`#[ts(concrete(..)]`** \
229+
/// Disables one ore more generic type parameters by specifying a concrete type for them. \
236230
/// The resulting TypeScript definition will not be generic over these parameters and will use the
237-
/// provided type instead.
231+
/// provided type instead. \
238232
/// This is especially useful for generic types containing associated types. Since TypeScript does
239233
/// not have an equivalent construct to associated types, we cannot generate a generic definition
240-
/// for them. Using `#[ts(concrete(..)]`, we can however generate a non-generic definition.
234+
/// for them. Using `#[ts(concrete(..)]`, we can however generate a non-generic definition. \
241235
/// Example:
242236
/// ```
243237
/// # use ts_rs::TS;
@@ -246,9 +240,8 @@ mod tokio;
246240
/// struct SearchResult<I: Iterator>(Vec<I::Item>);
247241
/// // will always generate `type SearchResult = Array<String>`.
248242
/// ```
249-
/// <br/><br/>
250243
///
251-
/// - **`#[ts(bound)]`**
244+
/// - **`#[ts(bound)]`** \
252245
/// Override the bounds generated on the `TS` implementation for this type. This is useful in
253246
/// combination with `#[ts(concrete)]`, when the type's generic parameters aren't directly used
254247
/// in a field or variant.
@@ -284,115 +277,96 @@ mod tokio;
284277
/// inner: Inner<C>,
285278
/// }
286279
/// ```
287-
/// <br/><br/>
288280
///
289281
/// ### struct attributes
290-
/// - **`#[ts(tag = "..")]`**
282+
/// - **`#[ts(tag = "..")]`** \
291283
/// Include the structs name (or value of `#[ts(rename = "..")]`) as a field with the given key.
292-
/// <br/><br/>
293284
///
294-
/// - **`#[ts(optional_fields)]`**
295-
/// Makes all `Option<T>` fields in a struct optional.
285+
/// - **`#[ts(optional_fields)]`** \
286+
/// Makes all `Option<T>` fields in a struct optional. \
296287
/// If `#[ts(optional_fields)]` is present, `t?: T` is generated for every `Option<T>` field of the struct.
297288
/// If `#[ts(optional_fields = nullable)]` is present, `t?: T | null` is generated for every `Option<T>` field of the struct.
298-
/// <br/><br/>
299289
///
300290
/// ### struct field attributes
301291
///
302-
/// - **`#[ts(type = "..")]`**
303-
/// Overrides the type used in TypeScript.
292+
/// - **`#[ts(type = "..")]`** \
293+
/// Overrides the type used in TypeScript. \
304294
/// This is useful when there's a type for which you cannot derive `TS`.
305-
/// <br/><br/>
306295
///
307-
/// - **`#[ts(as = "..")]`**
308-
/// Overrides the type of the annotated field, using the provided Rust type instead.
296+
/// - **`#[ts(as = "..")]`** \
297+
/// Overrides the type of the annotated field, using the provided Rust type instead. \
309298
/// This is useful when there's a type for which you cannot derive `TS`.
310299
/// `_` may be used to refer to the type of the field, e.g `#[ts(as = "Option<_>")]`.
311-
/// <br/><br/>
312300
///
313-
/// - **`#[ts(rename = "..")]`**
301+
/// - **`#[ts(rename = "..")]`** \
314302
/// Renames this field. To rename all fields of a struct, see the container attribute `#[ts(rename_all = "..")]`.
315-
/// <br/><br/>
316303
///
317-
/// - **`#[ts(inline)]`**
304+
/// - **`#[ts(inline)]`** \
318305
/// Inlines the type of this field, replacing its name with its definition.
319-
/// <br/><br/>
320306
///
321-
/// - **`#[ts(skip)]`**
307+
/// - **`#[ts(skip)]`** \
322308
/// Skips this field, omitting it from the generated *TypeScript* type.
323-
/// <br/><br/>
324309
///
325-
/// - **`#[ts(optional)]`**
326-
/// May be applied on a struct field of type `Option<T>`. By default, such a field would turn into `t: T | null`.
310+
/// - **`#[ts(optional)]`** \
311+
/// May be applied on a struct field of type `Option<T>`. By default, such a field would turn into `t: T | null`. \
327312
/// If `#[ts(optional)]` is present, `t?: T` is generated instead.
328313
/// If `#[ts(optional = nullable)]` is present, `t?: T | null` is generated.
329314
/// `#[ts(optional = false)]` can override the behaviour for this field if `#[ts(optional_fields)]`
330315
/// is present on the struct itself.
331-
/// <br/><br/>
332316
///
333-
/// - **`#[ts(flatten)]`**
317+
/// - **`#[ts(flatten)]`** \
334318
/// Flatten this field, inlining all the keys of the field's type into its parent.
335-
/// <br/><br/>
336319
///
337320
/// ### enum attributes
338321
///
339-
/// - **`#[ts(tag = "..")]`**
340-
/// Changes the representation of the enum to store its tag in a separate field.
322+
/// - **`#[ts(tag = "..")]`** \
323+
/// Changes the representation of the enum to store its tag in a separate field. \
341324
/// See [the serde docs](https://serde.rs/enum-representations.html) for more information.
342-
/// <br/><br/>
343325
///
344-
/// - **`#[ts(content = "..")]`**
345-
/// Changes the representation of the enum to store its content in a separate field.
326+
/// - **`#[ts(content = "..")]`** \
327+
/// Changes the representation of the enum to store its content in a separate field. \
346328
/// See [the serde docs](https://serde.rs/enum-representations.html) for more information.
347-
/// <br/><br/>
348329
///
349-
/// - **`#[ts(untagged)]`**
350-
/// Changes the representation of the enum to not include its tag.
330+
/// - **`#[ts(untagged)]`** \
331+
/// Changes the representation of the enum to not include its tag. \
351332
/// See [the serde docs](https://serde.rs/enum-representations.html) for more information.
352-
/// <br/><br/>
353333
///
354-
/// - **`#[ts(rename_all = "..")]`**
355-
/// Rename all variants of this enum.
334+
/// - **`#[ts(rename_all = "..")]`** \
335+
/// Rename all variants of this enum. \
356336
/// Valid values are `lowercase`, `UPPERCASE`, `camelCase`, `snake_case`, `PascalCase`, `SCREAMING_SNAKE_CASE`, "kebab-case" and "SCREAMING-KEBAB-CASE"
357-
/// <br/><br/>
358337
///
359-
/// - **`#[ts(rename_all_fields = "..")]`**
338+
/// - **`#[ts(rename_all_fields = "..")]`** \
360339
/// Renames the fields of all the struct variants of this enum. This is equivalent to using
361340
/// `#[ts(rename_all = "..")]` on all of the enum's variants.
362341
/// Valid values are `lowercase`, `UPPERCASE`, `camelCase`, `snake_case`, `PascalCase`, `SCREAMING_SNAKE_CASE`, "kebab-case" and "SCREAMING-KEBAB-CASE"
363-
/// <br/><br/>
364342
///
365-
/// - **`#[ts(repr(enum))]`**
366-
/// Exports the enum as a TypeScript enum instead of type union
343+
/// - **`#[ts(repr(enum))]`** \
344+
/// Exports the enum as a TypeScript enum instead of type union. \
367345
/// Discriminants (`= {integer}`) are included in the exported enum's variants
368346
/// If `#[ts(repr(enum = name))]` is used, all variants without a discriminant will be exported
369347
/// as `VariantName = "VariantName"`
370-
/// <br/><br/>
371348
///
372349
/// ### enum variant attributes
373350
///
374-
/// - **`#[ts(rename = "..")]`**
351+
/// - **`#[ts(rename = "..")]`** \
375352
/// Renames this variant. To rename all variants of an enum, see the container attribute `#[ts(rename_all = "..")]`.
376353
/// This attribute also accepts expressions, e.g `#[ts(rename = module_path!().rsplit_once("::").unwrap().1)]`.
377-
/// <br/><br/>
378354
///
379-
/// - **`#[ts(skip)]`**
355+
/// - **`#[ts(skip)]`** \
380356
/// Skip this variant, omitting it from the generated *TypeScript* type.
381-
/// <br/><br/>
382357
///
383-
/// - **`#[ts(untagged)]`**
358+
/// - **`#[ts(untagged)]`** \
384359
/// Changes this variant to be treated as if the enum was untagged, regardless of the enum's tag
385360
/// and content attributes
386-
/// <br/><br/>
387361
///
388-
/// - **`#[ts(rename_all = "..")]`**
389-
/// Renames all the fields of a struct variant.
362+
/// - **`#[ts(rename_all = "..")]`** \
363+
/// Renames all the fields of a struct variant. \
390364
/// Valid values are `lowercase`, `UPPERCASE`, `camelCase`, `snake_case`, `PascalCase`, `SCREAMING_SNAKE_CASE`, "kebab-case" and "SCREAMING-KEBAB-CASE"
391365
/// <br/><br/>
392366
pub trait TS {
393367
/// If this type does not have generic parameters, then `WithoutGenerics` should just be `Self`.
394368
/// If the type does have generic parameters, then all generic parameters must be replaced with
395-
/// a dummy type, e.g `ts_rs::Dummy` or `()`.
369+
/// a dummy type, e.g `ts_rs::Dummy` or `()`. \
396370
/// The only requirement for these dummy types is that `EXPORT_TO` must be `None`.
397371
///
398372
/// # Example:

0 commit comments

Comments
 (0)