carbon icon indicating copy to clipboard operation
carbon copied to clipboard

Malformatted code

Open miguelvr opened this issue 1 year ago • 2 comments

Describe the bug Go code appears malformatted

To Reproduce Steps to reproduce the behavior:

  1. Go to carbon.now.sh
  2. type the following code:
type Greeter interface {
  Greet(target string) string
}
  1. Copy image to clipboard, get the following: image

Expected behavior Proper formatting

Info (please complete the following information):

  • OS [e.g. macOS, Linux, Windows, iOS]: macOS
  • Browser [e.g. Chrome, Safari, Firefox]: Chrome
  • Carbon URL [e.g. carbon.now.sh?bg=pink]: https://carbon.now.sh/?bg=rgba%28255%2C255%2C255%2C1%29&t=one-light&wt=none&l=text%2Fx-go&width=680&ds=false&dsyoff=20px&dsblur=68px&wc=true&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=14px&lh=133%2525&si=false&es=2x&wm=false&code=type%2520Greeter%2520interface%2520%257B%250A%2520%2520Greet%28target%2520string%29%2520string%250A%257D

miguelvr avatar Feb 27 '23 22:02 miguelvr

Hello,

Just adding a comment here.

Currently it is not only related to golang but every language. The image copied inside the clipboard is different than the one displayed in the website if the sentence is "too long"

Thanks !

SilverBzH avatar Mar 14 '23 20:03 SilverBzH

I have the same problem.

class Person: NSObject, NSCoding {
    
    var name : String
    var sex : Int
        
    enum Key: String {
        case name
        case sex
    }
    
    init(name: String, sex: Int) {
        self.name = name
        self.sex = sex
    }
    
    func encode(with coder: NSCoder) {
        coder.encode(name, forKey: Key.name.rawValue)
        coder.encode(sex, forKey: Key.sex.rawValue)
    }
    
    required convenience init?(coder decoder: NSCoder) {
       let name = decoder.decodeObject(forKey: Key.name.rawValue)
        let sex = decoder.decodeInteger(forKey: Key.sex.rawValue)
        
        if let name = name as? String {
            self.init(name: name, sex: sex)
        }
        return nil
    }
    
}

carbon

Export with svg, everything works fine.

Fidetro avatar Mar 19 '23 05:03 Fidetro