Skip to content

Commit ebce60d

Browse files
authored
Merge pull request #30 from contentauth/api-doc-improvement
I'm going to merge this to improve the docs served at https://contentauth.github.io/c2pa-node-v2/. Next week, I plan to add a workflow to automate the API doc generation when there is a release (or on some other trigger) and remove the TypeDoc-generated .md files from the repo.
2 parents bdadab2 + 83fe599 commit ebce60d

File tree

10 files changed

+95
-122
lines changed

10 files changed

+95
-122
lines changed

docs/README.md

Lines changed: 9 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: README
3+
layout: none
4+
---
5+
16
**@contentauth/c2pa-node**
27

38
***
@@ -6,66 +11,16 @@
611

712
## [Classes](classes/index.md)
813

9-
- [Builder](classes/Builder.md)
10-
- [CallbackCredentialHolder](classes/CallbackCredentialHolder.md)
11-
- [CallbackSigner](classes/CallbackSigner.md)
12-
- [IdentityAssertionBuilder](classes/IdentityAssertionBuilder.md)
13-
- [IdentityAssertionSigner](classes/IdentityAssertionSigner.md)
14-
- [LocalSigner](classes/LocalSigner.md)
15-
- [Reader](classes/Reader.md)
16-
- [Trustmark](classes/Trustmark.md)
14+
{% include_relative classes/index.md %}
1715

1816
## [Interfaces](interfaces/index.md)
1917

20-
- [BuilderInterface](interfaces/BuilderInterface.md)
21-
- [CallbackCredentialHolderInterface](interfaces/CallbackCredentialHolderInterface.md)
22-
- [CallbackSignerInterface](interfaces/CallbackSignerInterface.md)
23-
- [DestinationBufferAsset](interfaces/DestinationBufferAsset.md)
24-
- [FileAsset](interfaces/FileAsset.md)
25-
- [HashedUri](interfaces/HashedUri.md)
26-
- [IdentityAssertionBuilderInterface](interfaces/IdentityAssertionBuilderInterface.md)
27-
- [IdentityAssertionSignerInterface](interfaces/IdentityAssertionSignerInterface.md)
28-
- [JsCallbackSignerConfig](interfaces/JsCallbackSignerConfig.md)
29-
- [LocalSignerInterface](interfaces/LocalSignerInterface.md)
30-
- [ReaderInterface](interfaces/ReaderInterface.md)
31-
- [SignerPayload](interfaces/SignerPayload.md)
32-
- [SourceBufferAsset](interfaces/SourceBufferAsset.md)
33-
- [TrustConfig](interfaces/TrustConfig.md)
34-
- [TrustmarkConfig](interfaces/TrustmarkConfig.md)
35-
- [TrustmarkInterface](interfaces/TrustmarkInterface.md)
36-
- [VerifyConfig](interfaces/VerifyConfig.md)
18+
{% include_relative interfaces/index.md %}
3719

3820
## [Type Aliases](type-aliases/index.md)
3921

40-
- [CallbackSignerConfig](type-aliases/CallbackSignerConfig.md)
41-
- [ClaimVersion](type-aliases/ClaimVersion.md)
42-
- [DestinationAsset](type-aliases/DestinationAsset.md)
43-
- [ManifestAssertionKind](type-aliases/ManifestAssertionKind.md)
44-
- [NeonBuilderHandle](type-aliases/NeonBuilderHandle.md)
45-
- [NeonCallbackCredentialHolderHandle](type-aliases/NeonCallbackCredentialHolderHandle.md)
46-
- [NeonCallbackSignerHandle](type-aliases/NeonCallbackSignerHandle.md)
47-
- [NeonIdentityAssertionBuilderHandle](type-aliases/NeonIdentityAssertionBuilderHandle.md)
48-
- [NeonIdentityAssertionSignerHandle](type-aliases/NeonIdentityAssertionSignerHandle.md)
49-
- [NeonLocalSignerHandle](type-aliases/NeonLocalSignerHandle.md)
50-
- [NeonReaderHandle](type-aliases/NeonReaderHandle.md)
51-
- [NeonTrustmarkHandle](type-aliases/NeonTrustmarkHandle.md)
52-
- [SigningAlg](type-aliases/SigningAlg.md)
53-
- [SourceAsset](type-aliases/SourceAsset.md)
54-
- [TrustmarkVariant](type-aliases/TrustmarkVariant.md)
55-
- [TrustmarkVersion](type-aliases/TrustmarkVersion.md)
22+
{% include_relative type-aliases/index.md %}
5623

5724
## [Functions](functions/index.md)
5825

59-
- [getCawgTrustConfig](functions/getCawgTrustConfig.md)
60-
- [getSettingsJson](functions/getSettingsJson.md)
61-
- [getTrustConfig](functions/getTrustConfig.md)
62-
- [getVerifyConfig](functions/getVerifyConfig.md)
63-
- [isActionsAssertion](functions/isActionsAssertion.md)
64-
- [loadC2paSettings](functions/loadC2paSettings.md)
65-
- [loadC2paSettingsToml](functions/loadC2paSettingsToml.md)
66-
- [loadCawgTrustConfig](functions/loadCawgTrustConfig.md)
67-
- [loadSettingsFromFile](functions/loadSettingsFromFile.md)
68-
- [loadSettingsFromUrl](functions/loadSettingsFromUrl.md)
69-
- [loadTrustConfig](functions/loadTrustConfig.md)
70-
- [loadVerifyConfig](functions/loadVerifyConfig.md)
71-
- [patchVerifyConfig](functions/patchVerifyConfig.md)
26+
{% include_relative functions/index.md %}

docs/_includes/nav-items.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
{%- assign nav_items = "Classes, Interfaces, Type Aliases, Functions" | split: ", " -%}
12
<div class="nav-items">
2-
{%- for path in include.paths -%}
3-
{%- assign hyperpage = site.pages | where: "path", path | first -%}
4-
{%- if hyperpage.title %}
5-
<a class="nav-item" href="{{ hyperpage.url | relative_url }}">{{ hyperpage.title | escape }}</a>
6-
{%- endif -%}
7-
{%- endfor %}
3+
{% for item in nav_items %}
4+
{%- assign path = '/' | append: (item | slugify) | append: '/' -%}
5+
<a class="nav-item" href="{{ path | relative_url }}">{{ item }}</a>
6+
{% endfor %}
87
</div>
8+

docs/_includes/sidebar.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
{%- assign readme_page = site.pages | where: "path", "README.md" | first -%}
1+
{%- assign readme_page = site.pages | where: "name", "README.md" | first -%}
2+
23
{%- if readme_page -%}
34
<nav class="sidebar-content">
4-
{%- assign _c = readme_page.content -%}
5-
{%- assign _c = _c | replace: "This is API documentation for the C2PA Node.js library.", "" -%}
6-
{%- assign _c = _c | replace: "# @contentauth/c2pa-node", "" -%}
7-
{{ _c | strip | markdownify }}
5+
{{ readme_page.content | strip | markdownify }}
86
</nav>
97
{%- endif -%}
108

docs/assets/css/cai-custom.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
max-width: 320px;
1515
}
1616
.sidebar-content { font-size: 0.95em; line-height: 1.45; }
17-
.sidebar-content h1 { font-size: 1.1rem; margin-top: 1rem; }
18-
.sidebar-content h2 { font-size: 1rem; margin-top: 0.9rem; }
17+
.sidebar-content h2 { font-size: 1.5rem; margin-top: 0.9rem; }
1918
.sidebar-content h3 { font-size: 0.95rem; margin-top: 0.8rem; }
2019
.sidebar-content ul { list-style: none; padding-left: 0; }
2120
.sidebar-content li { margin: 0.25rem 0; }
@@ -46,6 +45,8 @@
4645

4746
.sidebar-content > p:first-child { display: none; }
4847
.sidebar-content hr { display: none; }
48+
.sidebar-content h1 { display: none; }
49+
4950

5051
@media (max-width: 900px) {
5152
.site-layout { grid-template-columns: 1fr; }

docs/classes/index.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# Classes
22

3-
- [Builder](Builder.md)
4-
- [CallbackCredentialHolder](CallbackCredentialHolder.md)
5-
- [CallbackSigner](CallbackSigner.md)
6-
- [IdentityAssertionBuilder](IdentityAssertionBuilder.md)
7-
- [IdentityAssertionSigner](IdentityAssertionSigner.md)
8-
- [LocalSigner](LocalSigner.md)
9-
- [Reader](Reader.md)
10-
- [Trustmark](Trustmark.md)
3+
{%- assign classes_root = site.baseurl | append: '/classes/' -%}
4+
{%- assign class_pages = site.pages | where_exp: 'p', "p.url contains '/classes/'" -%}
5+
{%- assign class_pages = class_pages | reject: 'url', classes_root -%}
6+
{% assign class_pages = class_pages | sort: 'name' %}
7+
8+
{% if class_pages and class_pages.size > 0 %}
9+
{%- for p in class_pages -%}
10+
{% assign label = p.name | replace: '.md','' | replace: '.html','' %}
11+
{%- unless p.name=="index.md" %}
12+
- <a href="{{ p.url | relative_url }}">{{ label }}</a>
13+
{%- endunless -%}
14+
{%- endfor -%}
15+
{%- else -%}
16+
No classes found.
17+
{%- endif -%}

docs/functions/index.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# Functions
22

3-
- [getCawgTrustConfig](getCawgTrustConfig.md)
4-
- [getSettingsJson](getSettingsJson.md)
5-
- [getTrustConfig](getTrustConfig.md)
6-
- [getVerifyConfig](getVerifyConfig.md)
7-
- [isActionsAssertion](isActionsAssertion.md)
8-
- [loadC2paSettings](loadC2paSettings.md)
9-
- [loadC2paSettingsToml](loadC2paSettingsToml.md)
10-
- [loadCawgTrustConfig](loadCawgTrustConfig.md)
11-
- [loadSettingsFromFile](loadSettingsFromFile.md)
12-
- [loadSettingsFromUrl](loadSettingsFromUrl.md)
13-
- [loadTrustConfig](loadTrustConfig.md)
14-
- [loadVerifyConfig](loadVerifyConfig.md)
15-
- [patchVerifyConfig](patchVerifyConfig.md)
3+
{%- assign functions_root = site.baseurl | append: '/functions/' -%}
4+
{%- assign functions_pages = site.pages | where_exp: 'p', "p.url contains '/functions/'" -%}
5+
{%- assign functions_pages = functions_pages | reject: 'url', functions_root -%}
6+
{% assign functions_pages = functions_pages | sort: 'name' %}
7+
8+
{% if functions_pages and functions_pages.size > 0 %}
9+
{%- for p in functions_pages -%}
10+
{% assign label = p.name | replace: '.md','' | replace: '.html','' %}
11+
{%- unless p.name=="index.md" %}
12+
- <a href="{{ p.url | relative_url }}">{{ label }}</a>
13+
{%- endunless -%}
14+
{%- endfor -%}
15+
{%- else -%}
16+
No functions found.
17+
{%- endif -%}

docs/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
layout: base
3+
title: C2PA Node.js library
4+
---
5+
6+
This is the API reference documentation for the C2PA Node.js library generated using TypeDoc.
7+
8+
- [Classes](./classes/)
9+
- [Interfaces](./interfaces/)
10+
- [Type Aliases](./type-aliases/)
11+
- [Functions](./functions/)
12+
13+

docs/interfaces/index.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
# Interfaces
22

3-
- [BuilderInterface](BuilderInterface.md)
4-
- [CallbackCredentialHolderInterface](CallbackCredentialHolderInterface.md)
5-
- [CallbackSignerInterface](CallbackSignerInterface.md)
6-
- [DestinationBufferAsset](DestinationBufferAsset.md)
7-
- [FileAsset](FileAsset.md)
8-
- [HashedUri](HashedUri.md)
9-
- [IdentityAssertionBuilderInterface](IdentityAssertionBuilderInterface.md)
10-
- [IdentityAssertionSignerInterface](IdentityAssertionSignerInterface.md)
11-
- [JsCallbackSignerConfig](JsCallbackSignerConfig.md)
12-
- [LocalSignerInterface](LocalSignerInterface.md)
13-
- [ReaderInterface](ReaderInterface.md)
14-
- [SignerPayload](SignerPayload.md)
15-
- [SourceBufferAsset](SourceBufferAsset.md)
16-
- [TrustConfig](TrustConfig.md)
17-
- [TrustmarkConfig](TrustmarkConfig.md)
18-
- [TrustmarkInterface](TrustmarkInterface.md)
19-
- [VerifyConfig](VerifyConfig.md)
3+
{%- assign interfaces_root = site.baseurl | append: '/interfaces/' -%}
4+
{%- assign interfaces_pages = site.pages | where_exp: 'p', "p.url contains '/interfaces/'" -%}
5+
{%- assign interfaces_pages = interfaces_pages | reject: 'url', interfaces_root -%}
6+
{% assign interfaces_pages = interfaces_pages | sort: 'name' %}
7+
8+
{% if interfaces_pages and interfaces_pages.size > 0 %}
9+
{%- for p in interfaces_pages -%}
10+
{% assign label = p.name | replace: '.md','' | replace: '.html','' %}
11+
{%- unless p.name=="index.md" %}
12+
- <a href="{{ p.url | relative_url }}">{{ label }}</a>
13+
{%- endunless -%}
14+
{%- endfor -%}
15+
{%- else -%}
16+
No interfaces found.
17+
{%- endif -%}

docs/type-aliases/index.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
# Type Aliases
22

3-
- [CallbackSignerConfig](CallbackSignerConfig.md)
4-
- [ClaimVersion](ClaimVersion.md)
5-
- [DestinationAsset](DestinationAsset.md)
6-
- [ManifestAssertionKind](ManifestAssertionKind.md)
7-
- [NeonBuilderHandle](NeonBuilderHandle.md)
8-
- [NeonCallbackCredentialHolderHandle](NeonCallbackCredentialHolderHandle.md)
9-
- [NeonCallbackSignerHandle](NeonCallbackSignerHandle.md)
10-
- [NeonIdentityAssertionBuilderHandle](NeonIdentityAssertionBuilderHandle.md)
11-
- [NeonIdentityAssertionSignerHandle](NeonIdentityAssertionSignerHandle.md)
12-
- [NeonLocalSignerHandle](NeonLocalSignerHandle.md)
13-
- [NeonReaderHandle](NeonReaderHandle.md)
14-
- [NeonTrustmarkHandle](NeonTrustmarkHandle.md)
15-
- [SigningAlg](SigningAlg.md)
16-
- [SourceAsset](SourceAsset.md)
17-
- [TrustmarkVariant](TrustmarkVariant.md)
18-
- [TrustmarkVersion](TrustmarkVersion.md)
3+
{%- assign type_aliases_root = site.baseurl | append: '/type-aliases/' -%}
4+
{%- assign type_aliases_pages = site.pages | where_exp: 'p', "p.url contains '/type-aliases/'" -%}
5+
{%- assign type_aliases_pages = type_aliases_pages | reject: 'url', type_aliaseses_root -%}
6+
{% assign type_aliases_pages = type_aliases_pages | sort: 'name' %}
7+
8+
{% if type_aliases_pages and type_aliases_pages.size > 0 %}
9+
{%- for p in type_aliases_pages -%}
10+
{% assign label = p.name | replace: '.md','' | replace: '.html','' %}
11+
{%- unless p.name=="index.md" %}
12+
- <a href="{{ p.url | relative_url }}">{{ label }}</a>
13+
{%- endunless -%}
14+
{%- endfor -%}
15+
{%- else -%}
16+
No type aliases found.
17+
{%- endif -%}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"scripts": {
2323
"build": "run-s build:rust build:ts",
2424
"build:debug": "run-s build:rust-debug build:ts",
25-
"build:docs": "rimraf docs && typedoc --plugin typedoc-plugin-markdown --readme none --out docs js-src/index.ts",
25+
"build:docs": "rimraf docs-typedoc && typedoc --plugin typedoc-plugin-markdown --readme none --out docs-typedoc js-src/index.ts && cpy \"docs-typedoc/**\" docs --parents --overwrite --ignore=\"docs-typedoc/classes/index.md\" --ignore=\"docs-typedoc/README.md\" && rimraf docs-typedoc",
2626
"build:rust": "pnpm run build:rust-debug --release",
2727
"build:rust-debug": "cargo build --message-format=json-render-diagnostics > cargo.log",
2828
"build:ts": "tsc -b && cpy index.node dist && cpy index.node js-src && cpy --flat js-src/types.d.ts dist/types",

0 commit comments

Comments
 (0)