validator/README.md
A validator for the AMP HTML format.
If you just want to validate a page, please see our documentation over at amp.dev.
Please see js/chromeextension/README.md.
An extension for Visual Studio Code VSCode marketplace
Please see js/nodejs/README.md.
Please see js/webui/README.md.
The validator rules are exported in the JSON format and hosted on: https://cdn.ampproject.org/v0/validator.json
The JSON rules are provided on best-effort basis and it's not recommended to rely on them in a production environment.
This is only useful development - e.g. when making changes to
cpp/engine/validator.h.
root user inside the docker container.
docker run -it -u root cimg/openjdk:17.0-node bash
apt update
apt install -y python sudo
git clone https://github.com/ampproject/amphtml.git
cd amphtml
npm install
npm run postinstall
.circleci/install_validator_dependencies.sh
In amphtml/validator folder, run
bazel build cpp/engine/wasm:validator_js_bin
This creates bazel-bin/cpp/engine/wasm/validator_js_bin.js, which is
equivalent to the validator deployed at cdn.ampproject.org.
You may now use the --validator_js command line flag to
amphtml-validator to use this validator.
In amphtml folder, run
amp validator-cpp && echo SUCCESS || echo FAIL
To see more information of the tests
sed -i 's/--test_output=errors//' build-system/tasks/validator.js
sed -i 's/--ui_event_filters=INFO//' build-system/tasks/validator.js
Then re-run amp validator-cpp && echo SUCCESS || echo FAIL.