1
0
Fork
You've already forked validate
0
Validate HTML pages in Go
  • Go 100%
2026年07月09日 20:49:24 +09:00
build build: Make test.yaml also compile executable. 2024年12月26日 08:45:21 -04:00
cmd/validate_page Minor staticcheck/gopls fixes. 2026年04月02日 13:03:14 -06:00
amp.go Use http.NewRequestWithContext instead of NewRequest. 2024年04月16日 08:40:56 -04:00
amp_test.go Upgrade to Go 1.19 and use AMP_TEMP_DIR. 2024年08月14日 09:19:15 -04:00
browser.go Minor staticcheck/gopls fixes. 2026年04月02日 13:03:14 -06:00
css.go Minor staticcheck/gopls fixes. 2026年04月02日 13:03:14 -06:00
css_test.go Minor tweaks to failure messages in css_test.go. 2021年09月29日 12:08:04 -04:00
doc.go Initial commit: Add HTML(), LaunchBrowser(), and validate_page. 2020年05月08日 15:00:42 -04:00
go.mod Use Go 1.25.12 and golang.org/x/net@v0.55.0 for govulncheck. 2026年07月09日 20:49:24 +09:00
go.sum Use Go 1.25.12 and golang.org/x/net@v0.55.0 for govulncheck. 2026年07月09日 20:49:24 +09:00
html.go Minor staticcheck/gopls fixes. 2026年04月02日 13:03:14 -06:00
html_test.go Update TestHTML_Invalid for validator change. 2025年12月27日 21:23:24 -07:00
LICENSE Add LICENSE. 2020年05月08日 15:28:18 -04:00
README.md Fix build status URLs in README.md. [skip ci] 2024年06月07日 19:50:27 +08:00
validate.go Use http.NewRequestWithContext instead of NewRequest. 2024年04月16日 08:40:56 -04:00

validate

GoDoc Build Status

The codeberg.org/derat/validate Go package validates:

Supplied documents are uploaded (in the case of online validators) and any issues identified by the validator are parsed and returned.

Usage

import("codeberg.org/derat/validate")// ...f,err:=os.Open("page.html")iferr!=nil{// ...}deferf.Close()// See also validate.AMP() and validate.CSS().issues,out,err:=validate.HTML(context.Background(),f)iferr!=nil{// ...}// Iterate over the parsed issues.for_,is:=rangeissues{fmt.Println(is)}// Display the full results page in a browser.iferr:=validate.LaunchBrowser(out);err!=nil{// ...}

A command-line program named validate_page that validates a file or a document provided over stdin is also provided:

% go install codeberg.org/derat/validate/cmd/validate_page
% validate_page -browser page.html
% validate_page -type=amp index.amp.html
% validate_page <style.css
% validate_page -type=htmlcss -browser page.html # check CSS in HTML doc