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

When formatting HTML with preserved comments those are not positioned on new line #190

Closed
PrzemyslawKlys opened this issue Nov 9, 2020 · 4 comments · Fixed by #224
Closed

Comments

@PrzemyslawKlys
Copy link

Formatting in VSCode

<!DOCTYPE html>
<html>
    <!-- HEADER -->

    <head>
        <meta charset="utf-8" />
        <meta content="width=device-width, initial-scale=1" name="viewport" />
        <meta name="author" />
        <meta content="2019-08-11 21:12:31" name="revised" />
        <title>Title</title><!-- CSS Default fonts START -->
        <link href="https://fonts.googleapis.com/css?family=Roboto|Hammersmith+One|Questrial|Oswald" type="text/css" rel="stylesheet" /><!-- CSS Default fonts END -->
        <!-- CSS Default fonts icons START -->
        <link href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" type="text/css" rel="stylesheet" /><!-- CSS Default fonts icons END -->
        <!-- CSS Always Required Default Visual Settings START -->
        <style type="text/css">

Formatting in NUGlify

<!DOCTYPE html>
<html><!-- HEADER -->
    <head>
        <meta charset=utf-8 />
        <meta content="width=device-width, initial-scale=1" name=viewport />
        <meta name=author />
        <meta content="2019-08-11 21:12:31" name=revised />
        <title>Title</title><!-- CSS Default fonts START -->
        <link href="https://fonts.googleapis.com/css?family=Roboto|Hammersmith+One|Questrial|Oswald" type=text/css rel=stylesheet /><!-- CSS Default fonts END --><!-- CSS Default fonts icons START -->
        <link href=https://use.fontawesome.com/releases/v5.7.2/css/all.css type=text/css rel=stylesheet /><!-- CSS Default fonts icons END --><!-- CSS Always Required Default Visual Settings START -->
        <style>

Potentially comments should respect the same settings as other HTML codes. I guess if there is a start comment there should be end comment somewhere and those should be on their new lines?

@trullock
Copy link
Owner

Theres no such thing as "start" and "end" comments, so thats out.

Besides that, I don't like either of these snippets as a default style :/

@PrzemyslawKlys
Copy link
Author

PrzemyslawKlys commented Nov 10, 2020

I would probably prefer comment on new line (without added empty line), but I guess it depends on situation. I usually add comments before/after something but as you said it's not something that can be done. Up to you. I can close it if you wish :)

@trullock
Copy link
Owner

This is definitely something to be improved upon so keep it open, I just dont know exactly what to do at this moment.

I'll think on it!

trullock added a commit that referenced this issue Dec 30, 2020
@trullock trullock mentioned this issue Dec 30, 2020
trullock added a commit that referenced this issue Dec 30, 2020
@trullock
Copy link
Owner

I've made comments always go on a new line when prettifying.

This seems the best solution

trullock added a commit that referenced this issue Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants