-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Building out a proper website for csharpier (#609)
* Building out website using docusaurus closes #505 * Some self code review * Finishing touches
- Loading branch information
Showing
57 changed files
with
10,485 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,6 @@ jobs: | |
- name: Push to dokku | ||
uses: dokku/github-action@master | ||
with: | ||
git_remote_url: 'ssh://[email protected]:22/csharpier' | ||
git_remote_url: 'ssh://[email protected]:22/csharpier-playground' | ||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
git_push_flags: --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Deploy Website | ||
on: | ||
push: | ||
branches: [ master ] | ||
paths: | ||
- 'Src/Website/**' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cloning repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Push to dokku | ||
uses: dokku/github-action@master | ||
with: | ||
git_remote_url: 'ssh://[email protected]:22/csharpier' | ||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
git_push_flags: --force |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
hide_table_of_contents: true | ||
--- | ||
CSharpier can be used to programmatically format code. | ||
|
||
This requires adding the [CSharpier.Core](https://www.nuget.org/packages/CSharpier.Core/) nuget package to your project. | ||
```bash | ||
dotnet add package CSharpier.Core | ||
``` | ||
|
||
```csharp | ||
|
||
var unformattedCode = "public class ClassName { }" | ||
|
||
var formattedCode = CodeFormatter.Format(unformattedCode); | ||
var asyncFormattedCode = await CodeFormatter.FormatAsync(unformattedCode); | ||
|
||
var options = new CodeFormatterOptions { Width = 60 }; | ||
|
||
var narrowerCode = CodeFormatter.Format(unformattedCode, options); | ||
var asyncNarrowerCode = await CodeFormatter.FormatAsync(unformattedCode, options); | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: What is CSharpier? | ||
id: About | ||
hide_table_of_contents: true | ||
--- | ||
|
||
CSharpier is an opinionated code formatter for c#. It uses Roslyn to parse your code and re-prints it using its own rules. | ||
The printing process was ported from [prettier](https://github.com/prettier/prettier) but has evolved over time. | ||
|
||
CSharpier provides a few basic options that affect formatting and has no plans to add more. It follows the [Option Philosophy](https://prettier.io/docs/en/option-philosophy.html) of prettier. | ||
|
||
### Before | ||
```csharp | ||
public class ClassName { | ||
public string ShortPropertyName { | ||
get; | ||
set; | ||
} | ||
|
||
public void LongUglyMethod(string longParameter1, string longParameter2, string longParameter3) { | ||
this.LongUglyMethod("1234567890", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); | ||
} | ||
} | ||
``` | ||
|
||
### After | ||
```csharp | ||
public class ClassName | ||
{ | ||
public string ShortPropertyName { get; set; } | ||
|
||
public void LongUglyMethod( | ||
string longParameter1, | ||
string longParameter2, | ||
string longParameter3 | ||
) | ||
{ | ||
this.LongUglyMethod( | ||
"1234567890", | ||
"abcdefghijklmnopqrstuvwxyz", | ||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
|
||
--- | ||
hide_table_of_contents: true | ||
--- | ||
### Command Line Options | ||
```console | ||
Usage: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: Editor Integration | ||
hide_table_of_contents: true | ||
--- | ||
|
||
Running CSharpier on save is recommended. It will speed up your development time. | ||
|
||
### Visual Studio | ||
Use the [official 2022 extension](https://marketplace.visualstudio.com/items?itemName=csharpier.CSharpier) | ||
Use the [official 2019 extension](https://marketplace.visualstudio.com/items?itemName=csharpier.CSharpier2019) | ||
### Visual Studio Code | ||
Use the [official extension](https://marketplace.visualstudio.com/items?itemName=csharpier.csharpier-vscode) | ||
### Rider | ||
Use the [official plugin](https://plugins.jetbrains.com/plugin/18243-csharpier) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
hide_table_of_contents: true | ||
--- | ||
|
||
CSharpier is implemented as a dotnet tool and can be installed with the following commands. | ||
|
||
```bash | ||
# if you don't yet have a .config/dotnet-tools.json file | ||
dotnet new tool-manifest | ||
|
||
dotnet tool install csharpier | ||
``` | ||
|
||
This will as a local dotnet tool for the directory these commands are run from. This ensures the project gets the correct version of CSharpier. | ||
|
||
Dotnet tools can also be installed globally with the following command. | ||
|
||
```bash | ||
dotnet tool install -g csharpier | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.