Skip to content

Commit db4bfae

Browse files
authored
docs: Migrate Mapster Docs from wiki to docfx
2 parents 9103951 + 0ea68ea commit db4bfae

File tree

72 files changed

+3776
-34
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+3776
-34
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
agent: 'agent'
3+
tools: ['changes', 'search/codebase', 'edit/editFiles', 'problems']
4+
description: 'Ensure that C# types are documented with XML comments and follow best practices for documentation.'
5+
---
6+
7+
# C# Documentation Best Practices
8+
9+
- Public members should be documented with XML comments.
10+
- It is encouraged to document internal members as well, especially if they are complex or not self-explanatory.
11+
12+
## Guidance for all APIs
13+
14+
- Use `<summary>` to provide a brief, one sentence, description of what the type or member does. Start the summary with a present-tense, third-person verb.
15+
- Use `<remarks>` for additional information, which can include implementation details, usage notes, or any other relevant context.
16+
- Use `<see langword>` for language-specific keywords like `null`, `true`, `false`, `int`, `bool`, etc.
17+
- Use `<c>` for inline code snippets.
18+
- Use `<example>` for usage examples on how to use the member.
19+
- Use `<code>` for code blocks. `<code>` tags should be placed within an `<example>` tag. Add the language of the code example using the `language` attribute, for example, `<code language="csharp">`.
20+
- Use `<see cref>` to reference other types or members inline (in a sentence).
21+
- Use `<seealso>` for standalone (not in a sentence) references to other types or members in the "See also" section of the online docs.
22+
- Use `<inheritdoc/>` to inherit documentation from base classes or interfaces.
23+
- Unless there is major behavior change, in which case you should document the differences.
24+
25+
## Methods
26+
27+
- Use `<param>` to describe method parameters.
28+
- The description should be a noun phrase that doesn't specify the data type.
29+
- Begin with an introductory article.
30+
- If the parameter is a flag enum, start the description with "A bitwise combination of the enumeration values that specifies...".
31+
- If the parameter is a non-flag enum, start the description with "One of the enumeration values that specifies...".
32+
- If the parameter is a Boolean, the wording should be of the form "`<see langword="true" />` to ...; otherwise, `<see langword="false" />`.".
33+
- If the parameter is an "out" parameter, the wording should be of the form "When this method returns, contains .... This parameter is treated as uninitialized.".
34+
- Use `<paramref>` to reference parameter names in documentation.
35+
- Use `<typeparam>` to describe type parameters in generic types or methods.
36+
- Use `<typeparamref>` to reference type parameters in documentation.
37+
- Use `<returns>` to describe what the method returns.
38+
- The description should be a noun phrase that doesn't specify the data type.
39+
- Begin with an introductory article.
40+
- If the return type is Boolean, the wording should be of the form "`<see langword="true" />` if ...; otherwise, `<see langword="false" />`.".
41+
42+
## Constructors
43+
44+
- The summary wording should be "Initializes a new instance of the <Class> class [or struct].".
45+
46+
## Properties
47+
48+
- The `<summary>` should start with:
49+
- "Gets or sets..." for a read-write property.
50+
- "Gets..." for a read-only property.
51+
- "Gets [or sets] a value that indicates whether..." for properties that return a Boolean value.
52+
- Use `<value>` to describe the value of the property.
53+
- The description should be a noun phrase that doesn't specify the data type.
54+
- If the property has a default value, add it in a separate sentence, for example, "The default is `<see langword="false" />`".
55+
- If the value type is Boolean, the wording should be of the form "`<see langword="true" />` if ...; otherwise, `<see langword="false" />`. The default is ...".
56+
57+
## Exceptions
58+
59+
- Use `<exception cref>` to document exceptions thrown by constructors, properties, indexers, methods, operators, and events.
60+
- Document all exceptions thrown directly by the member.
61+
- For exceptions thrown by nested members, document only the exceptions users are most likely to encounter.
62+
- The description of the exception describes the condition under which it's thrown.
63+
- Omit "Thrown if ..." or "If ..." at the beginning of the sentence. Just state the condition directly, for example "An error occurred when accessing a Message Queuing API."
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build and Deploy DocFX
2+
3+
on:
4+
push:
5+
branches: [ 'master' ]
6+
paths:
7+
- 'docs/**'
8+
- 'README.md'
9+
# Uncomment this if API docs changes should trigger a rebuild of the documentation
10+
# - 'src/**'
11+
- '.github/workflows/build-deploy-docs.yml'
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
concurrency:
20+
group: pages
21+
cancel-in-progress: false
22+
23+
jobs:
24+
build-docs:
25+
if: ${{ github.ref == 'refs/heads/master' }}
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Setup .NET
33+
uses: actions/setup-dotnet@v4
34+
with:
35+
dotnet-version: |
36+
8.x
37+
9.x
38+
# - name: Show dotnet version
39+
# run: |
40+
# dotnet --list-sdks
41+
# dotnet --list-runtimes
42+
43+
# - name: Restore dependencies before docs deployment as recommended by docfx
44+
# run: dotnet restore ./src/Mapster.sln
45+
46+
# - name: Build with dotnet
47+
# run: dotnet build ./src/Mapster.sln
48+
49+
# - name: Run tests on .NET 9.0
50+
# run: dotnet test --verbosity normal ./src/Mapster.sln
51+
52+
- name: Install DocFX as .NET tool
53+
run: |
54+
dotnet tool update -g docfx
55+
56+
- name: Build docfx site
57+
working-directory: docs
58+
run: docfx docfx.json
59+
60+
- name: Upload artifact
61+
uses: actions/upload-pages-artifact@v3
62+
with:
63+
# Upload entire repository
64+
path: 'docs/_site'
65+
66+
deploy-docs:
67+
needs: build-docs
68+
if: ${{ needs.build-docs.result == 'success' && github.ref == 'refs/heads/master' }}
69+
environment:
70+
name: github-pages
71+
url: ${{ steps.deployment.outputs.page_url }}
72+
runs-on: ubuntu-latest
73+
74+
steps:
75+
- name: Deploy to GitHub Pages
76+
id: deployment
77+
uses: actions/deploy-pages@v4
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Conventional Commits
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- development
8+
- release/*
9+
10+
env:
11+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
13+
jobs:
14+
commitsar:
15+
name: Validate for conventional commits
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v1
20+
- name: Run commitsar
21+
uses: aevea/[email protected]

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ packages/
131131
# This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented)
132132
!packages/build/
133133

134+
# Not ignore packages folder in docs folder
135+
!docs/articles/packages/
136+
134137
# Windows Azure Build Output
135138
csx/
136139
*.build.csdef
@@ -184,5 +187,4 @@ src/.idea
184187

185188
# VS Code settings
186189
.vscode/launch.json
187-
.vscode/settings.json
188190
.vscode/tasks.json

.markdownlint.jsonc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/v0.38.0/schema/markdownlint-config-schema.json",
3+
"default": true,
4+
"line-length": false,
5+
"commands-show-output": false,
6+
"no-bare-urls": false,
7+
"no-inline-html": false,
8+
"no-duplicate-heading": false,
9+
"no-emphasis-as-heading": false,
10+
// Headers must start at the beginning of the line - false positive in some cases where it makes sense.
11+
"MD023": false,
12+
// First line in a file should be a top-level heading - false positive for include files.
13+
"MD041": false,
14+
// Link fragments should be valid - false positive for docfx tabs
15+
"MD051": false
16+
}

.vscode/extensions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"DavidAnson.vscode-markdownlint",
4+
"streetsidesoftware.code-spell-checker-cspell-bundled-dictionaries",
5+
"ms-vscode.powershell",
6+
"joshbolduc.commitlint"
7+
]
8+
}

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"files.associations": {
3+
"*.agent.md": "chatagent",
4+
"*.instructions.md": "instructions",
5+
"*.prompt.md": "prompt",
6+
"docfx.json": "jsonc"
7+
}
8+
}

CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
![Mapster Icon](https://raw.githubusercontent.com/MapsterMapper/Mapster/master/docs/images/mapster-logo.svg)
2+
3+
# Contributing to Mapster
4+
5+
Thank you for your interest in contributing! We welcome contributions from the community.
6+
7+
## How to Contribute
8+
9+
1. **Fork the repository** and create your branch from [`development`](https://github.com/MapsterMapper/Mapster/tree/development)
10+
2. **Make your changes** following the existing code style
11+
3. **Write tests** using [MSTest](https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-mstest) and [xUnit](https://xunit.net/) to ensure your changes work correctly
12+
4. **Document your code** with XML comments and update [docs/articles/](./docs/articles/) if needed following the [DocFX](https://dotnet.github.io/docfx/) guidelines
13+
5. **Commit with clear messages** following [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) (e.g., `feat:`, `fix:`, `docs:`)
14+
6. **Submit a pull request** with a description of your changes
15+
16+
## Reporting Issues
17+
18+
Found a bug or have a feature request? Please [open an issue](https://github.com/MapsterMapper/Mapster/issues) with:
19+
20+
- Clear description of the problem or request
21+
- Steps to reproduce (for bugs)
22+
- Code samples if applicable
23+
- Environment details (Mapster version, .NET version)
24+
25+
For questions, use [GitHub Discussions](https://github.com/MapsterMapper/Mapster/discussions).
26+
27+
## Development Guidelines
28+
29+
- Follow existing code conventions
30+
- Add XML documentation for public APIs
31+
- Write unit tests for new features and bug fixes
32+
- Keep code clean, well-documented, and tested
33+
34+
## License
35+
36+
By contributing, you agree that your contributions will be licensed under the [MIT License](LICENSE).

0 commit comments

Comments
 (0)