Scroll to navigation

DH_DOC_PRIVACY(1) Debhelper Commands DH_DOC_PRIVACY(1)

NAME

dh_doc_privacy - remove remote assets from package documentation

DESCRIPTION

This debhelper command removes remotely hosted assets from documentation before the documentation is converted to HTML or installed under /usr/share/doc.

It is intended to prevent installed documentation from triggering network requests for badges, embedded widgets, or tracking scripts when viewed in a web browser.

The command rewrites matching files in place. When a file is modified during a package build, its original content is stored so that dh_clean can restore it from debian/.debhelper/.

usage: dh_doc_privacy [-h] [-X PATTERN] [--no-act] [--verbose] [--version]

[--sourcedir DIR] [-a] [-i] [-p PACKAGE] [-N PACKAGE]
[-P DIR] [--remaining-packages] [PATH ...]

Remove remote badge images, iframes, and tracking scripts from documentation files before they are shipped in a Debian package.

By default the command scans the top-level README.md, README.rst, and README.html files. You can also pass explicit files or directories to process.

positional arguments:

file or directory to process; defaults to top-level README files

options:

show this help message and exit
skip files whose path contains PATTERN; may be specified multiple times
report files that would be changed without modifying them
print a message for each file that is examined or changed
show program's version number and exit
treat DIR as the package source root instead of the current directory

debhelper compatibility:

accepted without changing which source files are cleaned

-a, --arch

-i, --indep

-p, --package PACKAGE

-N, --no-package PACKAGE

-P, --tmpdir DIR

--remaining-packages

SEQUENCE INTEGRATION

Add dh-sequence-doc-privacy to Build-Depends to enable automatic cleanup. Alternatively, depend on dh-doc-privacy and pass --with doc_privacy to dh. The command runs before dh_update_autotools_config, ahead of configuration and building, and processes the top-level README files by default.

The options -a/--arch, -i/--indep, -p/--package, -N/--no-package, -P/--tmpdir, and --remaining-packages are accepted for compatibility. They do not restrict cleanup, which operates on the shared source tree. Use PATH arguments and -X to select documentation files. Forwarded -O options are ignored; other unknown options are errors.

To customise paths with the sequence enabled:

override_dh_doc_privacy:
	dh_doc_privacy README.md docs/source/ -Xgenerated

LIMITATIONS

Markdown reference-style images are not currently removed. In RST raw HTML blocks, remote image, iframe, script, and link elements are removed; ordinary hyperlinks and unrelated content are retained.

FILES

Without explicit PATH arguments, dh_doc_privacy examines README.md, README.rst, and README.html in the top level of the source tree.

When a directory is given, files ending in .md, .rst, and .html below that directory are processed recursively.

EXAMPLES

Run during a package build before generating documentation:

override_dh_auto_build:
	dh_doc_privacy README.md docs/source/
	dh_auto_build

SEE ALSO

debhelper(7), dh(1), lintian(1)

September 2026 Debian