Skip to content

Tidy moves HTML comments to previous line #808

Open
@pdurbin

Description

@pdurbin

Hi! I noticed that Tidy moves HTML comments to the previous line. Is there a way to prevent this? I'm using Tidy 5.2.0, packaged with the latest Ubuntu LTS, 18.04. Here's a "before" and "after" to show how the comment "<!-- for mobile -->" is moved by Tidy:

Before (HTML comment above the line the comment is about)

<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Linux version 5.2.0">
<meta charset="UTF-8">
<!-- for mobile -->
<meta name="viewport" content=
"width=device-width, initial-scale=1">
<title>HTML Tidy</title>

After (HTML comment moved to end of previous line)

<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Linux version 5.2.0">
<meta charset="UTF-8"><!-- for mobile -->
<meta name="viewport" content=
"width=device-width, initial-scale=1">
<title>HTML Tidy</title>
<meta name="keywords" content="tidy, html tidy, html, htacg">

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions