Skip to content

Commit a54efc3

Browse files
committed
Added dotnet serve local tool and script that enable hosting docs website locally
1 parent f04daf5 commit a54efc3

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"dotnet-serve": {
6+
"version": "1.7.125",
7+
"commands": [
8+
"dotnet-serve"
9+
]
10+
}
11+
}
12+
}

docs/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Contributing to the documentation
2+
3+
This folder contains the documentation site for bUnit.
4+
5+
Here is a small getting started guide for contributing to the documentation.
6+
7+
## Structure
8+
9+
1. The `site` folder contains the code for generating the documentation site, _and_ the documentation in markdown files, located in `site/docs`.
10+
2. The `samples` folder projects for the sample code that is displayed in the documentation. It has the following projects:
11+
- `samples/components`: A Blazor component library project where components under test are placed.
12+
- `samples/tests/mstest`: A MSTest project, where MSTest test samples are placed.
13+
- `samples/tests/nunit`: A NUnit project, where NUnit test samples are placed.
14+
- `samples/tests/razor`: A xUnit based test project, where razor test samples are placed.
15+
- `samples/tests/xunit`: A xUnit project, where xUnit C# only test samples are placed.
16+
17+
These samples components source files and tests source files are included in the documentation using [DocFx's Code Snippet syntax](https://dotnet.github.io/docfx/spec/docfx_flavored_markdown.html?tabs=tabid-1%2Ctabid-a#code-snippet). They are created as real projects, making them runnable, which helps ensure that the code shown in the documentation pages are correct and works.
18+
19+
## Building and view docs locally
20+
21+
To build and view the documentation locally, a few steps is needed:
22+
23+
1. From `docs/site` run `dotnet build`. If you get warnings from running `dotnet build`, try running it again.
24+
2. From `docs/` run `serve-docs.cmd`, it will start up a local web server, hosting the generated documentation site on http://localhost:8080, using the [`dotnet serve` tool](https://github.com/natemcmaster/dotnet-serve).
25+
3. After changing samples, from `docs/samples`, run `dotnet test`. This will compile the sample components and run the sample tests.
26+
27+
## Documentation writing rules
28+
29+
- All pages should have a [YAML header](https://dotnet.github.io/docfx/spec/docfx_flavored_markdown.html#yaml-header) with an `UID` to enable easy [cross reference](https://dotnet.github.io/docfx/spec/docfx_flavored_markdown.html#cross-reference) between pages
30+
- All page and code references should be created using the [`xref:UID` cross reference syntax](https://dotnet.github.io/docfx/tutorial/links_and_cross_references.html#using-cross-reference).
31+
- Prefer to include code snippets as from sample files in the `samples` projects, using the [code snippet syntax](https://dotnet.github.io/docfx/spec/docfx_flavored_markdown.html#code-snippet).

docs/serve-docs.cmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
dotnet-serve -d "site/_site" -h "Cache-Control: no-cache"

0 commit comments

Comments
 (0)