carbon-app / carbon

:black_heart: Create and share beautiful images of your source code
https://carbon.now.sh
MIT License
34.5k stars 1.91k forks source link

Malformatted code #1455

Open miguelvr opened 1 year ago

miguelvr commented 1 year ago

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
    }
  3. Copy image to clipboard, get the following: image

Expected behavior Proper formatting

Info (please complete the following information):

SilverBzH commented 1 year ago

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 !

Fidetro commented 1 year ago

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.