Skip to content

Commit 191c914

Browse files
authored
Merge pull request #562 from SciSharp/docfx2
feat(docs): upgrade to DocFX v2 modern template
2 parents 91da60c + a954b03 commit 191c914

File tree

15 files changed

+935
-72
lines changed

15 files changed

+935
-72
lines changed

.github/workflows/docs.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ on:
44
push:
55
branches: ["master", "main"]
66
paths:
7-
- 'docs/website/**'
7+
- 'src/**'
8+
- 'docs/website-src/**'
89
workflow_dispatch:
910

1011
permissions:
@@ -17,7 +18,7 @@ concurrency:
1718
cancel-in-progress: false
1819

1920
jobs:
20-
deploy:
21+
build-and-deploy:
2122
environment:
2223
name: github-pages
2324
url: ${{ steps.deployment.outputs.page_url }}
@@ -26,6 +27,23 @@ jobs:
2627
- name: Checkout
2728
uses: actions/checkout@v4
2829

30+
- name: Setup .NET
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: '8.0.x'
34+
35+
- name: Install DocFX
36+
run: dotnet tool install -g docfx
37+
38+
- name: Build docs
39+
run: docfx docs/website-src/docfx.json
40+
41+
- name: Generate AI-friendly docs (llms.txt)
42+
run: |
43+
cd docs/website-src
44+
chmod +x scripts/generate-llms-txt.sh
45+
./scripts/generate-llms-txt.sh ../website
46+
2947
- name: Setup Pages
3048
uses: actions/configure-pages@v5
3149

docs/website-src/api/index.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1-
# NumSharp docfx documentation
1+
---
2+
uid: api-index
3+
---
24

3-
This is the autogenerated documentation of NumSharp
5+
# NumSharp API Reference
6+
7+
Browse the complete API documentation for NumSharp, including all classes, methods, and properties.
8+
9+
## Namespaces
10+
11+
- @NumSharp - Core types including `NDArray`, `Shape`, `np`
12+
- @NumSharp.Generic - Generic typed arrays like `NDArray<T>`
13+
- @NumSharp.Backends - Storage and computation backends
14+
15+
## Key Types
16+
17+
| Type | Description |
18+
|------|-------------|
19+
| @NumSharp.NDArray | The main multi-dimensional array type |
20+
| @NumSharp.Shape | Represents array dimensions and strides |
21+
| @NumSharp.np | Static API class for NumPy-style operations |
22+
| @NumSharp.Slice | Represents array slicing operations |
23+
24+
## Getting Started
25+
26+
```csharp
27+
using NumSharp;
28+
29+
// Create arrays
30+
var a = np.array(new[] { 1, 2, 3, 4, 5 });
31+
var b = np.zeros((3, 4));
32+
var c = np.random.randn(2, 3);
33+
34+
// Operations
35+
var sum = np.sum(a);
36+
var transposed = b.T;
37+
var sliced = a["1:4"];
38+
```

docs/website-src/docfx.json

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,61 @@
11
{
2+
"$schema": "https://raw.githubusercontent.com/dotnet/docfx/main/schemas/docfx.schema.json",
23
"metadata": [
34
{
45
"src": [
56
{
6-
"src": "../../",
7-
"files": [
8-
"src/NumSharp.Core/NumSharp.Core.csproj"
9-
]
7+
"src": "../../src",
8+
"files": ["NumSharp.Core/NumSharp.Core.csproj"]
109
}
1110
],
1211
"dest": "api",
12+
"includePrivateMembers": false,
1313
"disableGitFeatures": false,
14-
"disableDefaultFilter": false
14+
"disableDefaultFilter": false,
15+
"noRestore": false,
16+
"namespaceLayout": "flattened",
17+
"memberLayout": "samePage",
18+
"enumSortOrder": "declaringOrder",
19+
"allowCompilationErrors": false
1520
}
1621
],
1722
"build": {
1823
"content": [
1924
{
20-
"files": [
21-
"api/**.yml",
22-
"api/index.md"
23-
]
24-
},
25-
{
26-
"files": [
27-
"articles/**.md",
28-
"articles/**/toc.yml",
29-
"toc.yml",
30-
"*.md"
31-
]
25+
"files": ["**/*.{md,yml}"],
26+
"exclude": ["_site/**", "obj/**", "scripts/**", "filterConfig.yml", "templates/**"]
3227
}
3328
],
3429
"resource": [
3530
{
36-
"files": [
37-
"images/**"
38-
]
31+
"files": ["images/**"]
3932
}
4033
],
41-
"overwrite": [
42-
{
43-
"files": [
44-
"apidoc/**.md"
45-
],
46-
"exclude": [
47-
"obj/**",
48-
"_site/**"
49-
]
34+
"output": "../website",
35+
"template": ["default", "modern", "templates/numsharp"],
36+
"globalMetadata": {
37+
"_appName": "NumSharp",
38+
"_appTitle": "NumSharp Documentation",
39+
"_appLogoPath": "images/numsharp.icon.svg",
40+
"_appFaviconPath": "images/numsharp.icon128.png",
41+
"_appFooter": "<span>Copyright &copy; 2025 <a href='https://github.com/SciSharp'>SciSharp STACK</a>. Built with <a href='https://dotnet.github.io/docfx'>DocFX</a>.</span>",
42+
"_enableSearch": true,
43+
"_enableNewTab": true,
44+
"_disableContribution": false,
45+
"_disableNextArticle": false,
46+
"_lang": "en",
47+
"_gitContribute": {
48+
"repo": "https://github.com/SciSharp/NumSharp",
49+
"branch": "master"
5050
}
51-
],
52-
"dest": "../website",
53-
"globalMetadataFiles": [],
54-
"fileMetadataFiles": [],
55-
"template": [
56-
"default"
57-
],
58-
"postProcessors": [],
59-
"markdownEngineName": "markdig",
60-
"noLangKeyword": false,
61-
"keepFileLink": false,
62-
"cleanupCacheHistory": false,
63-
"disableGitFeatures": false
51+
},
52+
"sitemap": {
53+
"baseUrl": "https://scisharp.github.io/NumSharp",
54+
"changefreq": "weekly",
55+
"priority": 0.5
56+
},
57+
"xref": [],
58+
"xrefService": ["https://xref.docs.microsoft.com/query?uid={uid}"],
59+
"postProcessors": ["ExtractSearchIndex"]
6460
}
65-
}
61+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/website-src/filterConfig.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# DocFX API Filter Configuration
2+
# https://dotnet.github.io/docfx/docs/dotnet-api-docs.html#filter-apis
3+
#
4+
# Uncomment rules below to hide internal/utility types from API documentation.
5+
# To enable: add "filter": "filterConfig.yml" to metadata section in docfx.json
6+
7+
apiRules:
8+
# Include all public APIs by default
9+
- include:
10+
hasAttribute:
11+
uid: System.Runtime.CompilerServices.CompilerGeneratedAttribute
12+
type: Member
13+
exclude: true
14+
15+
# Uncomment to hide utility namespaces from public docs:
16+
# - exclude:
17+
# uidRegex: ^NumSharp\.Utilities
18+
# type: Namespace
19+
20+
# - exclude:
21+
# uidRegex: ^NumSharp\.Backends\.Unmanaged\.Pooling
22+
# type: Namespace
23+
24+
# Uncomment to hide internal helper classes:
25+
# - exclude:
26+
# uidRegex: Helper$
27+
# type: Class
28+
29+
# - exclude:
30+
# uidRegex: Extensions$
31+
# type: Class
32+
33+
# Uncomment to hide specific types:
34+
# - exclude:
35+
# uidRegex: ^NumSharp\.Utilities\.InfoOf
36+
# type: Class
37+
38+
# - exclude:
39+
# uidRegex: ^NumSharp\.Utilities\.Converts
40+
# type: Class

0 commit comments

Comments
 (0)