Last active
          August 26, 2018 16:16 
        
      - 
      
- 
        Save MoOx/336b9f0654538e5d5763 to your computer and use it in GitHub Desktop. 
    es5 string vs es6 template string
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Renderer.prototype.image = function(href, title, text) { | |
| var out = '<img src="' + href + '" alt="' + text + '"'; | |
| if (title) { | |
| out += ' title="' + title + '"'; | |
| } | |
| out += this.options.xhtml ? '/>' : '>'; | |
| return out; | |
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Renderer.prototype.image = function(href, title, text) { | |
| return ( | |
| `<img src="${href}" alt="${text}"` + | |
| `${title ? ` title="${title}"` : ``}` + | |
| `${this.options.xhtml ? "/>" : ">"` | |
| ) | |
| } | 
Yes but it add extra whitespace I don't want :)
it is not an extra whitespace, it renders this as \n\t (CRLF) which is on Windows.
if you try and print the literal it will be normal
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Doesn't this work:
?