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

Preformatted text #127

Merged
merged 25 commits into from
Aug 28, 2020
Merged

Preformatted text #127

merged 25 commits into from
Aug 28, 2020

Conversation

ehrencrona
Copy link
Contributor

@ehrencrona ehrencrona commented Aug 26, 2020

Maintain whitespace and newlines as-in inside <pre> tags, i.e. formatting

<pre>
  _______
 /  12   \
|    |    |
|9   |   3|
|     \   |
|         |
 \___6___/
</pre>

does not turn into

<pre> _______ / 12 \\ | | | |9 | 3| | \\ | | | \\___6___/</pre>

Also consider attribute values (with one exception: the class attribute) to be pre-formatted. Do not add or remove line breaks there.

This builds on PR #120. I thought it sensible to nevertheless keep it as a separate PR.

I got some code from #41, e.g. the isPreTagContent function.

Relates to #28 . I chose not to pursue the idea of configuring which tags are white-space sensitive. I'm happy to add that if there is a feeling it should be added; in any case it can easily be added on top of this PR.

@dummdidumm
Copy link
Member

I'm a little confused now on what to review first 😄 does this PR contain everything of #120 + the additional <pre> behavior?

@ehrencrona
Copy link
Contributor Author

@dummdidumm Yes it does. It probably makes sense to first review #120. If that is ok, this one (#127) can be reviewed and #116 can be closed.

If #120 is rejected, #127 can be closed (because it builds on it) but it's still worth taking a look at #116.

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor suggestion, that's all. 👍

src/print/index.ts Outdated Show resolved Hide resolved
@dummdidumm dummdidumm merged commit 9139b18 into sveltejs:master Aug 28, 2020
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

Successfully merging this pull request may close these issues.

2 participants