From 0cdf50f9bfea10b34f0326c4db5532f285453607 Mon Sep 17 00:00:00 2001 From: Christopher Warrington Date: Fri, 29 May 2020 02:04:06 -0700 Subject: [PATCH] Revise README now that packages are live of NuGet * Installation instructions now use NuGet to get the package. * Removed title section from HTML template: it duplicated a lot of stuff. * Now that the author isn't shown inline of the page, I can add it to the metadata. * Add highlight style based on the Kate style but with a grey background for code. --- README.md | 40 +++--- website/Makefile | 4 +- website/index.yaml | 2 + website/syntax/highlight.theme | 225 +++++++++++++++++++++++++++++++++ website/template/html.html | 14 -- 5 files changed, 252 insertions(+), 33 deletions(-) create mode 100644 website/syntax/highlight.theme diff --git a/README.md b/README.md index d15a862..aaf79f4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# .NET JSON Check +# dnjc, .NET JSON Check [.NET JSON Check][dnjc], `dnjc`, is a command line tool to check for JSON syntax errors using the [`System.Text.Json`][stj] parsers. @@ -10,27 +10,29 @@ PS> Get-Content "bad.json" | dnjc 6 2 '}' is an invalid start of a value. ``` -## Install +The source code [is hosted on GitHub](https://github.com/chwarr/dnjc). -For now, `dnjc` needs to be built from source. It can then be installed with -`dotnet tool install`: +## Install -The source code [is hosted on GitHub](https://github.com/chwarr/dnjc). +`dnjc` can be installed as a [.NET global tool][dotnet-global-tools]: ```powershell -cd /src # Adjust as needed -git clone "https://github.com/chwarr/dnjc.git" -cd dnjc -dotnet pack --configuration Release "dnjc.sln" -dotnet tool install ` - --global ` - --add-source "/src/dnjc/pack/Release/netcoreapp3.1" ` - DotNetJsonCheck.Tool +dotnet tool install --global DotNetJsonCheck.Tool ``` If this is the first .NET global tool you've installed, you may need to restart your shell/console for it to pick up the changes to your PATH. +## Versions + +The current versions of the tool and the library that powers it are shown +below. + +| Package | Version | +|---------|---------| +| DotNetJsonCheck.Tool | [![DotNetJsonCheck.Tool NuGet version](https://img.shields.io/nuget/v/DotNetJsonCheck.Tool?logo=nuget&style=flat-square)][nuget-dnjc-tool] | +| DotNetJsonCheck | [![DotNetJsonCheck NuGet version](https://img.shields.io/nuget/v/DotNetJsonCheck?logo=nuget&style=flat-square)][nuget-dnjc] | + ## Invocation After installing, invoke it, giving it the JSON you want to check on @@ -83,9 +85,9 @@ example, to allow comments but not trailing commas, pass `--strict The [Emacs][emacs] package `flycheck-dnjc.el` can be used to configure a [Flycheck][flycheck] checker that uses `dnjc`. -Install the `flycheck-dnjc.el` from where you cloned this repository. - -M-x `package-install-file` RET `/src/dnjc/flycheck-dnjc.el` +To install it, [download it][flycheck-dnjc.el] and then install it with +M-x `package-install-file` RET +`/path/to/where/you/downloaded/flycheck-dnjc.el` If you use [`use-package`][use-package] to manage your packages, add this to your `.emacs` file: @@ -152,12 +154,16 @@ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. A copy of the GNU Affero General Public License Version 3 is included in the -file [LICENSE]. +file [LICENSE] at the root of the repository. [dnjc]: https://www.thebluepolicebox.com/dnjc/ +[dotnet-global-tools]: https://aka.ms/global-tools [emacs]: https://www.gnu.org/software/emacs/ +[flycheck-dnjc.el]: https://raw.githubusercontent.com/chwarr/dnjc/master/emacs/flycheck-dnjc.el [flycheck]: https://www.flycheck.org/ [LICENSE]: https://github.com/chwarr/dnjc/blob/master/LICENSE [mecj]: https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.configuration.json?view=dotnet-plat-ext-3.1 +[nuget-dnjc-tool]: https://www.nuget.org/packages/DotNetJsonCheck.Tool/ +[nuget-dnjc]: https://www.nuget.org/packages/DotNetJsonCheck/ [stj]: https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=netcore-3.1 [use-package]: https://github.com/jwiegley/use-package diff --git a/website/Makefile b/website/Makefile index 8764565..64b4be7 100644 --- a/website/Makefile +++ b/website/Makefile @@ -18,13 +18,13 @@ .PHONY: all clean PANDOC = pandoc PANDOC_SYNTAX_DEFNS = --syntax-definition=syntax/jsonc.xml --syntax-definition=syntax/elisp.xml -PANDOC_OPTS = --highlight-style=kate --standalone --template=template/html.html +PANDOC_OPTS = --highlight-style=syntax/highlight.theme --standalone --template=template/html.html all: index.html clean: rm -f index.html -index.html: ../README.md index.yaml syntax/jsonc.xml syntax/elisp.xml template/html.html +index.html: ../README.md index.yaml syntax/jsonc.xml syntax/elisp.xml syntax/highlight.theme template/html.html $(PANDOC) $(PANDOC_SYNTAX_DEFNS) $(PANDOC_OPTS) --from=gfm --to=html --metadata-file=index.yaml --output "$@" "$<" minify "$@" --output "$@" diff --git a/website/index.yaml b/website/index.yaml index e2f4733..6adf595 100644 --- a/website/index.yaml +++ b/website/index.yaml @@ -14,5 +14,7 @@ # # SPDX-License-Identifier: AGPL-3.0-only +author: +- Christopher Warrington lang: en-us title: 'dnjc, .NET JSON Check: check for JSON errors using .NET' diff --git a/website/syntax/highlight.theme b/website/syntax/highlight.theme new file mode 100644 index 0000000..725d863 --- /dev/null +++ b/website/syntax/highlight.theme @@ -0,0 +1,225 @@ +{ + "text-color": "#1f1c1b", + "background-color": "#f2f2f2", + "line-number-color": "#a0a0a0", + "line-number-background-color": "#ffffff", + "text-styles": { + "Other": { + "text-color": "#006e28", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Attribute": { + "text-color": "#0057ae", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "SpecialString": { + "text-color": "#ff5500", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Annotation": { + "text-color": "#ca60ca", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "RegionMarker": { + "text-color": "#0057ae", + "background-color": "#e0e9f8", + "bold": false, + "italic": false, + "underline": false + }, + "Function": { + "text-color": "#644a9b", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "String": { + "text-color": "#bf0303", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "ControlFlow": { + "text-color": "#1f1c1b", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Operator": { + "text-color": "#1f1c1b", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Error": { + "text-color": "#bf0303", + "background-color": null, + "bold": false, + "italic": false, + "underline": true + }, + "Normal": { + "text-color": "#1f1c1b", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "BaseN": { + "text-color": "#b08000", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Alert": { + "text-color": "#bf0303", + "background-color": "#f7e6e6", + "bold": true, + "italic": false, + "underline": false + }, + "Variable": { + "text-color": "#0057ae", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "BuiltIn": { + "text-color": "#644a9b", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Extension": { + "text-color": "#0095ff", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Preprocessor": { + "text-color": "#006e28", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Information": { + "text-color": "#b08000", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "VerbatimString": { + "text-color": "#bf0303", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Warning": { + "text-color": "#bf0303", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Documentation": { + "text-color": "#607880", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Import": { + "text-color": "#ff5500", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Char": { + "text-color": "#924c9d", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "DataType": { + "text-color": "#0057ae", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Float": { + "text-color": "#b08000", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Comment": { + "text-color": "#898887", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "CommentVar": { + "text-color": "#0095ff", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Constant": { + "text-color": "#aa5500", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "SpecialChar": { + "text-color": "#3daee9", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "DecVal": { + "text-color": "#b08000", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Keyword": { + "text-color": "#1f1c1b", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + } + } +} diff --git a/website/template/html.html b/website/template/html.html index 724cde4..1a2f350 100644 --- a/website/template/html.html +++ b/website/template/html.html @@ -31,20 +31,6 @@ $for(include-before)$ $include-before$ $endfor$ -$if(title)$ -
-

$title$

-$if(subtitle)$ -

$subtitle$

-$endif$ -$for(author)$ -

$author$

-$endfor$ -$if(date)$ -

$date$

-$endif$ -
-$endif$ $if(toc)$