22
33[ ![ NuGet] ( http://img.shields.io/nuget/v/Atata.Cli.HtmlValidate.svg?style=flat )] ( https://www.nuget.org/packages/Atata.Cli.HtmlValidate/ )
44[ ![ GitHub release] ( https://img.shields.io/github/release/atata-framework/atata-cli-htmlvalidate.svg )] ( https://github.com/atata-framework/atata-cli-htmlvalidate/releases )
5+ [ ![ Build status] ( https://dev.azure.com/atata-framework/atata-cli-htmlvalidate/_apis/build/status/atata-cli-htmlvalidate-ci?branchName=main )] ( https://dev.azure.com/atata-framework/atata-cli-htmlvalidate/_build/latest?definitionId=43&branchName=main )
56[ ![ Slack] ( https://img.shields.io/badge/join-Slack-green.svg?colorB=4EB898 )] ( https://join.slack.com/t/atata-framework/shared_invite/zt-5j3lyln7-WD1ZtMDzXBhPm0yXLDBzbA )
67[ ![ Atata docs] ( https://img.shields.io/badge/docs-Atata_Framework-orange.svg )] ( https://atata.io )
78[ ![ Twitter
] ( https://img.shields.io/badge/[email protected] )] ( https://twitter.com/AtataFramework ) 1516- [ Features] ( #features )
1617- [ Installation] ( #installation )
1718- [ Usage] ( #usage )
19+ - [ HtmlValidateOptions Properties] ( #htmlvalidateoptions-properties )
20+ - [ HtmlValidateResult Properties] ( #htmlvalidateresult-properties )
1821- [ Feedback] ( #feedback )
1922- [ SemVer] ( #semver )
2023- [ License] ( #license )
2124
2225## Features
2326
24- To be added...
27+ Provides C#/.NET API for [ html-validate CLI] ( https://html-validate.org/usage/cli.html ) .
28+ Check out < https://html-validate.org > documentation for more info.
2529
2630## Installation
2731
28- Install [ ` Atata.Cli ` ] ( https://www.nuget.org/packages/Atata.Cli.HtmlValidate/ ) NuGet package.
32+ ### NuGet Package
33+
34+ Install [ ` Atata.Cli.HtmlValidate ` ] ( https://www.nuget.org/packages/Atata.Cli.HtmlValidate/ ) NuGet package.
2935
3036- Package Manager:
3137 ```
@@ -37,9 +43,71 @@ Install [`Atata.Cli`](https://www.nuget.org/packages/Atata.Cli.HtmlValidate/) Nu
3743 dotnet add package Atata.Cli.HtmlValidate
3844 ```
3945
46+ ### NPM Package
47+
48+ Requires [ html-validate] ( https://www.npmjs.com/package/html-validate ) NPM package to be installed.
49+
50+ - Using NPM Command:
51+ ```
52+ npm install -g html-validate
53+ ```
54+ - Using [ Atata.Cli.Npm] ( https://www.nuget.org/packages/Atata.Cli.Npm/ ) .NET library:
55+ ``` cs
56+ new NpmCli ()
57+ .InstallIfMissing (HtmlValidateCli .Name , global : true );
58+ ```
59+
4060## Usage
4161
42- To be added...
62+ The main class is ` HtmlValidateCli ` located in ` Atata.Cli.HtmlValidate ` namespace.
63+
64+ ### Validate HTML File
65+
66+ ``` cs
67+ HtmlValidateResult result1 = HtmlValidateCli .InDirectory (" some/dir" )
68+ .Validate (" testme.html" );
69+ ```
70+
71+ ### Validate HTML File With Options
72+
73+ ``` cs
74+ var options = new HtmlValidateOptions
75+ {
76+ Config = " someconfig.json" ,
77+ Formatter = HtmlValidateFormatter .Codeframe (" output.txt" )
78+ };
79+
80+ HtmlValidateResult result3 = HtmlValidateCli .InDirectory (" some/dir" )
81+ .Validate (" testme.html" , options );
82+ ```
83+
84+ ### Validate HTML File Asynchronously
85+
86+ ``` cs
87+ HtmlValidateResult result2 = await HtmlValidateCli .InDirectory (" some/dir" )
88+ .ValidateAsync (" testme.html" );
89+ ```
90+
91+ ## HtmlValidateOptions Properties
92+
93+ - ** ` HtmlValidateFormatter Formatter { get; set; } ` ** \
94+ Gets or sets the formatter.
95+ - ** ` int? MaxWarnings { get; set; } ` ** \
96+ Gets or sets the maximum allowed warnings count.
97+ The default value is ` null ` , which means that warnings are allowed.
98+ Use ` 0 ` to disallow warnings.
99+ - ** ` string Config { get; set; } ` ** \
100+ Gets or sets the configuration file path (full or relative to CLI ` WorkingDirectory ` ).
101+ - ** ` string[] Extensions { get; set; } ` ** \
102+ Gets or sets the file extensions to use when searching for files in directories.
103+ For example: ` "html" ` , ` "vue" ` , etc.
104+
105+ ## HtmlValidateResult Properties
106+
107+ - ** ` bool IsSuccessful { get; } ` ** \
108+ Gets a value indicating whether this result is successful.
109+ - ** ` string Output { get; } ` ** \
110+ Gets the text output of result.
43111
44112## Feedback
45113
0 commit comments