|
32 | 32 |
|
33 | 33 | npm install typedoc@0.27 |
34 | 34 |
|
35 | | - JSDoc 3.6.3 and 4.0.0 and TypeDoc 0.27 are known to work. |
| 35 | + JSDoc 3.6.3 and 4.0.0 and TypeDoc 0.25, 0.26, and 0.27 are known to work. |
36 | 36 |
|
37 | 37 |
|
38 | 38 | 2. Install sphinx-js, which will pull in Sphinx itself as a dependency:: |
@@ -248,6 +248,25 @@ result will be styled as a function, and ``@property`` tags will fall |
248 | 248 | misleadingly under an "Arguments" heading. Still, it's better than nothing |
249 | 249 | until we can do it properly. |
250 | 250 |
|
| 251 | +If you are using typedoc, it also is possible to destructure keyword arguments |
| 252 | +by using the `@destructure` tag:: |
| 253 | + |
| 254 | + /** |
| 255 | + * @param options |
| 256 | + * @destructure options |
| 257 | + */ |
| 258 | + function f({x , y } : { |
| 259 | + /** The x value */ |
| 260 | + x : number, |
| 261 | + /** The y value */ |
| 262 | + y : string |
| 263 | + }){ ... } |
| 264 | + |
| 265 | +will be documented like:: |
| 266 | + |
| 267 | + options.x (number) The x value |
| 268 | + options.y (number) The y value |
| 269 | + |
251 | 270 | autoclass |
252 | 271 | --------- |
253 | 272 |
|
@@ -401,6 +420,33 @@ or ``js:class`` and use the class's full (but dotted) path when you do:: |
401 | 420 | Unfortunately, Sphinx's ``~`` syntax doesn't work in these spots, so users will |
402 | 421 | see the full paths in the documentation. |
403 | 422 |
|
| 423 | +Typescript: Cross references |
| 424 | +---------------------------- |
| 425 | + |
| 426 | +Typescript types will be converted to cross references. To render cross |
| 427 | +references, you can define a hook in ``conf.py`` called `ts_type_xref_formatter`. It |
| 428 | +should take two arguments: the first argument is the sphinx confix, and the |
| 429 | +second is an ``sphinx_js.ir.TypeXRef`` object. This has a ``name`` field and two |
| 430 | +variants: |
| 431 | + |
| 432 | +* a ``sphinx_js.ir.TypeXRefInternal`` with fields ``path`` and ``kind`` |
| 433 | +* a ``sphinx_js.ir.TypeXRefExternal`` with fields ``name``, ``package``, |
| 434 | +``sourcefilename`` and ``qualifiedName`` |
| 435 | + |
| 436 | +The return value should be restructured text that you wish to be inserted in |
| 437 | +place of the type. For example: |
| 438 | + |
| 439 | +.. code-block:: python |
| 440 | +
|
| 441 | + def ts_xref_formatter(config, xref): |
| 442 | + if isinstance(xref, TypeXRefInternal): |
| 443 | + name = rst.escape(xref.name) |
| 444 | + return f":js:{xref.kind}:`{name}`" |
| 445 | + else: |
| 446 | + # Otherwise, don't insert a xref |
| 447 | + return xref.name |
| 448 | +
|
| 449 | +
|
404 | 450 | Configuration Reference |
405 | 451 | ----------------------- |
406 | 452 |
|
@@ -505,6 +551,57 @@ See ``CONTRIBUTORS`` for details. |
505 | 551 | Version History |
506 | 552 | =============== |
507 | 553 |
|
| 554 | +5.0.0: (Unreleased) |
| 555 | + * Droped support for Python 3.9 (pyodide/sphinx-js-fork#7) |
| 556 | + * Dropped support for typedoc 0.15, added support for typedoc 0.25, 0.26, and |
| 557 | + 0.27 (pyodide/sphinx-js-fork#11, pyodide/sphinx-js-fork#22, |
| 558 | + pyodide/sphinx-js-fork#31, pyodide/sphinx-js-fork#39, |
| 559 | + pyodide/sphinx-js-fork#41, pyodide/sphinx-js-fork#43 |
| 560 | + pyodide/sphinx-js-fork#52, pyodide/sphinx-js-fork#53, |
| 561 | + pyodide/sphinx-js-fork#54, pyodide/sphinx-js-fork#174) |
| 562 | + * Added handling for Typescript type parameters and type bounds. |
| 563 | + (pyodide/sphinx-js-fork#25) |
| 564 | + * Only monkeypatch Sphinx classes when sphinx_js extension is used |
| 565 | + (pyodide/sphinx-js-fork#27) |
| 566 | + * Allow using installation of ``typedoc`` or ``jsdoc`` from `node_modules` |
| 567 | + instead of requiring global install. (pyodide/sphinx-js-fork#33) |
| 568 | + * Handle markdown style codepens correctly in typedoc comments. |
| 569 | + (pyodide/sphinx-js-fork#47) |
| 570 | + * Added support for destructuring the documentation of keyword arguments in |
| 571 | + Typescript using the ``@destructure`` tag or the |
| 572 | + ``ts_should_destructure_arg`` hook. |
| 573 | + (pyodide/sphinx-js-fork#48, pyodide/sphinx-js-fork#74, |
| 574 | + pyodide/sphinx-js-fork#75, pyodide/sphinx-js-fork#101, |
| 575 | + pyodide/sphinx-js-fork#128) |
| 576 | + * Added rendering for cross references in Typescript types. |
| 577 | + (pyodide/sphinx-js-fork#51, pyodide/sphinx-js-fork#56, |
| 578 | + pyodide/sphinx-js-fork#67, pyodide/sphinx-js-fork#81, |
| 579 | + pyodide/sphinx-js-fork#82, pyodide/sphinx-js-fork#83, |
| 580 | + pyodide/sphinx-js-fork#153, pyodide/sphinx-js-fork#160) |
| 581 | + * Added rendering for function types in Typescript documentation. |
| 582 | + (pyodide/sphinx-js-fork#55, pyodide/sphinx-js-fork#58, |
| 583 | + pyodide/sphinx-js-fork#59) |
| 584 | + * Add async prefix to async functions (pyodide/sphinx-js-fork#65). |
| 585 | + * Added the ``sphinx-js_type`` css class around all types in documentation. This |
| 586 | + allows applying custom css just to types (pyodide/sphinx-js-fork#85) |
| 587 | + * Added ``ts_type_bold`` config option that applies css to ``.sphinx-js_type`` |
| 588 | + to render all types as bold. |
| 589 | + * Added ``js:automodule`` directive (pyodide/sphinx-js-fork#108) |
| 590 | + * Added ``js:autosummary`` directive (pyodide/sphinx-js-fork#109) |
| 591 | + * Added rendering for ``queryType`` (e.g., ``let y: typeof x;``) |
| 592 | + (pyodide/sphinx-js-fork#124) |
| 593 | + * Added rendering for ``typeOperator`` (e.g., ``let y: keyof x``) |
| 594 | + (pyodide/sphinx-js-fork#125) |
| 595 | + * Fixed crash when objects are reexported. (pyodide/sphinx-js-fork#126) |
| 596 | + * Added ``jsdoc_tsconfig_path`` which can specify the path to the |
| 597 | + ``tsconfig.json`` file that should be used. (pyodide/sphinx-js-fork#116) |
| 598 | + * Added a `js:interface` directive (pyodide/sphinx-js-fork#138). |
| 599 | + * Removed parentheses from xrefs to classes (pyodide/sphinx-js-fork#155). |
| 600 | + * Added a ``:js:typealias:`` directive (pyodide/sphinx-js-fork#156). |
| 601 | + * Added rendering for conditional, indexed access, inferred, mapped, optional, |
| 602 | + rest, and template litreal types (pyodide/sphinx-js-fork#157). |
| 603 | + * Added readonly prefix to readonly properties (pyodide/sphinx-js-fork#158). |
| 604 | + |
508 | 605 | 4.0.0: (December 23rd, 2024) |
509 | 606 | * Drop support for Python 3.8. |
510 | 607 | * Add support for Python 3.12 and 3.13. |
|
0 commit comments