Blank Lines (HTML) is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.
Blank Lines (HTML)
API ID: CountLineBlankHtmlLanguages: Web
Targets: Architectures, Files, Project
Number of blank HTML lines.
Only counts blank lines outside embedded sub-language blocks; a blank line inside a <script> block counts towards Blank Lines (JavaScript) instead.
For example:
<!DOCTYPE html>
<html>
<head>
<title>Welcome</title>
<!-- Greeting script: tracks visits and confirms with the user -->
<script>
// Number of times the page has greeted someone
var greetingCount = 0;
function greetUser(name) {
greetingCount++;
return "Hello, " + name + "!";
}
let message = greetUser("Ada");
console.log(message);
if (greetingCount > 0) {
confirm(message);
}
</script>
</head>
<body>
<h1>Welcome to the site</h1>
<p>Have a look around.</p>
</body>
</html>
Line 5, the blank line inside <head> before the script's comment, is the only blank HTML line. The three blank lines inside the <script> block (10, 15, 18) count towards Blank Lines (JavaScript) instead, giving CountLineBlankHtml = 1.
See Blank Lines (JavaScript) for blank lines inside embedded scripts, and Blank Lines for the language-independent metric this breaks down.
Targets By Language:- Web: Project, File
- This metric can be disabled from "Project Configuration/Metrics/Lines and Statements" with the "Show line count metrics" option.
- This metric can be enabled from "Project Configuration/Metrics/Lines and Statements" with the "Breakdown counts by web language" option.