Skip to content

Commit

Permalink
contrib: Document use of TypeDoc to see a local website documenting t…
Browse files Browse the repository at this point in the history
…he code.
  • Loading branch information
claremacrae committed Dec 8, 2024
1 parent 85005bc commit 1ffacd2
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contributing/Code/About Code.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ This section stores information about the design and implementation of the plugi

- [[Structure of the code]] - the directory structure of the source code

## Documenting the code

- [[Generating documentation of the code]] - browse the source code interactively, and see class hierarchies.

## Comment processes

- [[How do I add a new field to the Task class]]
Expand Down
48 changes: 48 additions & 0 deletions contributing/Code/Generating documentation of the code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
publish: true
---

# Generating documentation of the code

It is now possible for developers to create a local documentation website showing the source code of the Tasks plugin.

This can help gain an understanding of the code, and see relationships between classes and functions.

## Generating the documentation

```bash
yarn code-docs
```

This runs [TypeDoc](https://typedoc.org) to populate `code-docs/index.html` and related files.

See the `typedocOptions` section in [tsconfig.json](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/tsconfig.json) for options used.

## Launching the documentation

In WebStorm, use the following steps to view the generated documentation:

1. Open `code-docs/index.html`
2. Click on a browser icon to open the file in a browser of your choice.

![How to use WebStorm to open a web server showing the code documentation](webstorm-open-code-docs.png)
<span class="caption">How to use WebStorm to open a web server showing the code documentation</span>

## Using the documentation

A page like this (the Index) will open.

![Screenshot showing the code docs](code-docs-index-page.png)
<span class="caption">Screenshot showing the code docs</span>

1. Use the links on the left to browse the source code and its documentation.
2. The `Class Hierarchy` is especially useful.
3. When viewing classes and files, these Settings will be useful.
4. Click on the title to get back this Index page.

## Class Hierarchy

Here is a sample screenshot showing the class hierarchy:

![Screenshot showing the class hierarchy as of 8th December 2024|200](class-hierarchy.png)
<span class="caption">Screenshot showing the class hierarchy as of 8th December 2024</span>
Binary file added contributing/Code/class-hierarchy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added contributing/Code/code-docs-index-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added contributing/Code/webstorm-open-code-docs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1ffacd2

Please sign in to comment.