question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

not correctly joining lines for HTML

See original GitHub issue

This is really hurting me. Here is an example HTML file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>Test Line Join</title>
</head>

<body>
    <p>The key words <q><span class="spec-must">must</span></q>, <q><span

          class="spec-must-not">must not</span></q>, <q><span class="spec-must">required</span></q>, <q><span

          class="spec-must">shall</span></q>, <q><span class="spec-must-not">shall not</span></q>, <q><span

          class="spec-should">should</span></q>, <q><span class="spec-should-not">should not</span></q>, <q><span

          class="spec-should">recommended</span></q>, <q><span class="spec-may">may</span></q>, and <q><span

          class="spec-may">optional</span></q> in this document are to be interpreted as described in <a href="#ref-rfc2119" class="ref">RFC 2119</a>.</p>
</body>

</html>

js-beautify should be getting rid of all that whitespace inside the <span …> tag. I want js-beautify to give me this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>Test Line Join</title>
</head>

<body>
    <p>The key words <q><span class="spec-must">must</span></q>, <q><span class="spec-must-not">must not</span></q>, <q><span class="spec-must">required</span></q>, <q><span class="spec-must">shall</span></q>, <q><span class="spec-must-not">shall not</span></q>, <q><span class="spec-should">should</span></q>, <q><span class="spec-should-not">should not</span></q>, <q><span class="spec-should">recommended</span></q>, <q><span class="spec-may">may</span></q>, and <q><span class="spec-may">optional</span></q> in this document are to be interpreted as described in <a href="#ref-rfc2119" class="ref">RFC 2119</a>.</p>
</body>

</html>

But it doesn’t. This is a huge problem and is really dragging down the workflow. (The reason the lines are like that to begin with is a bug in BlueGriffon. So bugs in js-beautify are preventing it from fixing the bugs in BlueGriffon. Such is life.)

See #841.

Perhaps you could point me to a place in the code I might go to try to put in some workaround?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:26 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
bitwisemancommented, Apr 26, 2017

@garretwilson Thanks for the offer of compensation. I appreciate the thought. For me, much like @Glavin001, my main limitation is not money, but time.

What I need is people who can write code and tests that I don’t have to spend cycles debugging or fixing to join this project and contribute fixes. Until that happens, issues will continue to be addressed as I find time (that is to say, very slowly). Sorry, but that’s the reality.

0reactions
garretwilsoncommented, Oct 17, 2018

@madman-bob, @bitwiseman, and others, I cannot begin to express my appreciation for finally getting this bug fixed and released. After a little prodding on the atom-beautify side, we finally got this into the Atom plugin as well.

It’s hard to describe just how refreshing it is, when I reformat the ugly, buggy HTML that BlueGriffon puts out, to not have to manually search for those weird, wrapped lines that BlueGriffon should not have put in. Now js-beautify just fixes them, automatically (like it always should have). It’s so amazing that at times I think I’m dreaming. I cannot count up all the time this is saving me, reducing my workflow, and also reducing my irritation level (or at least not adding to it 😉 ).

Thank you, thank you, thank you.

And after I finally gave in and tried Visual Studio Code (after a long list of stupid Atom problems, the last one being that it reset my entire configuration for no reason one day; see https://github.com/atom/atom/issues/18229), I found out that there is a Beautify plugin for VS Code!

https://github.com/HookyQR/VSCodeBeautify

I was almost afraid to check, but yes… yes… the plugin includes the latest js-beautify 1.8.x!! This means that after installing VSCodeBeautify, I can open up my HTML and format it exactly like I did with atom-beautify (except using a different shortcut key), with the results being exactly the same—and it even uses the exact same .jsbeautifyrc file! This is the smoothest transition I could never have even dreamed possible. For once—for once—everything worked just like it should have.

I am very grateful. Thanks for making this happen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Dos and Don'ts of Adding an HTML Line Break
To do a line break in HTML, use the <br> tag. Simply place the tag wherever you want to force a line break....
Read more >
JOIN command does not join lines as expected in AutoCAD
AutoCAD: Attempting to join lines produces extra lines, different objects, or other unexpected result.
Read more >
HTML Line Break – How to Break a Line with the HTML <br ...
In this tutorial, I'm going to show you how to insert line breaks in your HTML code with some "with and without" examples,...
Read more >
No line-break after a hyphen - Stack Overflow
The problem is that near the end of a line, because of the hyphen, it breaks and wraps to the next line instead...
Read more >
HTML Style Guide and Coding Conventions - W3Schools
... type as the first line in your document. The correct document type for HTML is: ... Do not add blank lines, spaces,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found