Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Properly indent after optional close tag #188

Open

Description

@fulldecent

Description

Auto indentation should use knowledge of optional closing tags

Steps to Reproduce

  1. Blank document
  2. Save as bob.html
  3. Type:
<!doctype html>
<html>
<head>
  <title>Yo</title>
  <body>

Expected behavior: [What you expect to happen]

Upon typing the last > in <body> (or, alternatively, typing the space in <body class=...) that <body> line should be indented left. In other words, the same indentation level as the <head> line.

Actual behavior: [What actually happens]

The <body> line is indented as a subordinate (one level deeper of indentation) than the <head> line.

Reproduces how often: [What percentage of the time does it reproduce?]

100%.

Versions

Atom : 1.23.3
Electron: 1.6.15
Chrome : 56.0.2924.87
Node : 7.4.0

macOS 10.13.2 (17C205)

Additional Information

<head> => <body> is only one such scenario included in this issue. For a full list of optional close HTML tags, see O in the "End tag" column of https://www.w3.org/TR/html4/index/elements.html (I can't find the HTML5 version of this document).

See also https://www.w3.org/TR/html51/syntax.html#in-head for more discussion of HTML5 tokenization and tree building.

See also https://www.w3.org/TR/html51/syntax.html#the-stack-of-open-elements for discussion of special HTML5 elements.

Activity

  1. changed the title [-]Properly handle [/-] [+]Properly indent after optional close tag[/+] on Jan 11, 2018
  2. revelt commented on Apr 19, 2018

    @revelt

    Does the requested solution involve adding missing </head>?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions