Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle lack of optional closing tags #25

Open
MarkLodato opened this issue Oct 24, 2012 · 6 comments
Open

Handle lack of optional closing tags #25

MarkLodato opened this issue Oct 24, 2012 · 6 comments

Comments

@MarkLodato
Copy link

Many common tags in HTML5, such as <p> and <li>, do not require a closing tag, but the current indent file cannot handle this case. For example,

<ul>
  <li>a
  <li>b
  <li>c

gets turned into

<ul>
  <li>a
    <li>b
      <li>c
@stardiviner
Copy link

I guess <p> tag need a closing tag. And I think write HTML in a good style is better. No need to support those tags except some tags only have one tag without closing tag.

@MarkLodato
Copy link
Author

Closing optional tags is not universally considered "good style," and besides, the editor is not supposed to impose arbitrary style choices. It should simply interpret the specification correctly.

@othree
Copy link
Owner

othree commented Jan 30, 2013

There is no way to detect is this omit close tag or other case. Suggestion?

@MarkLodato
Copy link
Author

It is a bit challenging, but I think you could probably cover the most common cases:

  • inside a <p>, the following start at the same level: <p>, <ol>, <ul>, <dl>, <div> (and others, I think)
  • a <li> closes the previous <li>
  • a <dt> or <dd> closes the previous <dt> or <dd>
  • an <option> closes the previous <option>

@othree
Copy link
Owner

othree commented Feb 6, 2013

Thanks for suggestion. Looks possible but I can't give a promise.

othree pushed a commit that referenced this issue Oct 3, 2013
@othree othree closed this as completed in 6634a98 Oct 3, 2013
@mindfulmonk
Copy link

My indentation is now borked if I close <li>

    <ol>
    <li>Item1</li>
  <li>Item2</li>
</ol>

othree added a commit that referenced this issue Oct 20, 2013
@othree othree reopened this Jan 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants