8000 Preformatted text loses its formatting · Issue #23 · dy/xhtm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Preformatted text loses its formatting #23
Closed
@aral

Description

@aral

The spacing in preformatted text should be maintained.

To reproduce

import xhtm from 'xhtm'
import vhtml from 'vhtml' 

const html = xhtm.bind(vhtml)
const markup = html`
  <pre>
         ███                              ███      
       ███░                              ░░░███    
     ███░    ████████  ████████   ██████   ░░░███  
   ███░     ░░███░░███░░███░░███ ███░░███    ░░░███
  ░░░███     ░███ ░███ ░███ ░░░ ░███████      ███░ 
    ░░░███   ░███ ░███ ░███     ░███░░░     ███░   
      ░░░███ ░███████  █████    ░░██████  ███░     
        ░░░  ░███░░░  ░░░░░      ░░░░░░  ░░░       
             ░███                                  
             █████                                 
            ░░░░░                                    
</pre>
`

console.log(markup)

What should render

<pre>
       ███                              ███      
     ███░                              ░░░███    
   ███░    ████████  ████████   ██████   ░░░███  
 ███░     ░░███░░███░░███░░███ ███░░███    ░░░███
░░░███     ░███ ░███ ░███ ░░░ ░███████      ███░ 
  ░░░███   ░███ ░███ ░███     ░███░░░     ███░   
    ░░░███ ░███████  █████    ░░██████  ███░     
      ░░░  ░███░░░  ░░░░░      ░░░░░░  ░░░       
           ░███                                  
           █████                                 
          ░░░░░                                    
</pre>

What actually renders

███ ██████░ ░░░██████░ ████████ ████████ ██████ ░░░██████░ ░░███░░███░░███░░███ ███░░███ ░░░███░░░███ ░███ ░███ ░███ ░░░ ░███████ ███░░░░███ ░███ ░███ ░███ ░███░░░ ███░░░░███ ░███████ █████ ░░██████ ███░░░░ ░███░░░ ░░░░░ ░░░░░░ ░░░░████████░░░░░

Looks like this is due to the indentation fix at https://github.com/dy/xhtm/blob/master/htm.js#L90 but that seems to set expectations for the parsing in other places as merely removing it leads to other issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0