crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.36k stars 1.62k forks source link

Sanitize doc generation, pt. 2 #14646

Open nobodywasishere opened 4 months ago

nobodywasishere commented 4 months ago

This is a follow up to #13786, making libxml2 an optional compile-time dependency, fixing the issues with the previous PR (that had to be reverted #14595).

LibXML2 (and by proxy doc sanitization) can be enabled via the libxml2=1 make flag:

make libxml2=1

A warning is printed when building docs without this flag set, informing the user that doc sanitization is disabled:

❯ make docs
Using /opt/homebrew/opt/llvm/bin/llvm-config [version=18.1.6]
./bin/crystal docs src/docs_main.cr  --project-name=Crystal --project-version=1.13.0-dev --source-refname=8a01443aa
Using compiled compiler at .build/crystal
Crystal built without LibXML2 support, documentation sanitization disabled
cp -av doc/ docs/
doc/ -> docs
doc//assets -> docs/assets
doc//assets/crystal-born-and-raised.svg -> docs/assets/crystal-born-and-raised.svg

Resolves #13753