choojs / choojs/nanohtml

implicit/explicit whitespace

Open
#43 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
688
Forks
48
PR merge metrics
No merged PRs in 30d

Description

When working with a more strict layout, whitespace between elements can cause trouble. For example, if I have a couple of spans that need to be flush against each other, there can't be any whitespace between the span tags in the generated HTML. Unfortunately, bel (or hyperx?) preserves the whitespace from the input.

``` JavaScript
bel`


one
two


`.toString()
```

generates:

``` HTML

\n one\n two\n


```

To work around this issue, I'd have to

``` JavaScript
bel`


onetwo


`.toString()
```

Which isn't ideal, especially when multiple tags are involved or if they have attributes.

I like the way React deals with this issue: https://facebook.github.io/react/blog/2014/02/20/react-v0.9.html#jsx-whitespace

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.