carbon-app/carbon

Code is horizontally clipped when viewed in Medium as embedded content

Open

#1,259 opened on Sep 26, 2021

View on GitHub
 (2 comments) (0 reactions) (0 assignees)JavaScript (36,024 stars) (1,974 forks)batch import
bughelp wanted

Description

Describe the bug Code is horizontally clipped when viewed in Medium as embedded content

To Reproduce

  • Use https://carbon.now.sh/ to generat a code snippet
  • Paste embed URL into a Medium article + hit enter
  • You should be able to see clipped code with no way of horizontally scrolling

Expected behavior I would expect to be able to scroll left and right to see the rest of the code

Screenshots Info (please complete the following information):

  • iOS 14.7.1 iPhone 12 mini
  • Viewing on Medium's iPhone app
import UIKit

public extension UIScrollView {
    convenience init(stackView: UIStackView) {
        self.init(frame: .zero)

        stackView.translatesAutoresizingMaskIntoConstraints = false
        addSubview(stackView)

        NSLayoutConstraint.activate([
            stackView.topAnchor.constraint(equalTo: contentLayoutGuide.topAnchor),
            stackView.bottomAnchor.constraint(equalTo: contentLayoutGuide.bottomAnchor),
            stackView.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor),
            stackView.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor),
            contentLayoutGuide.widthAnchor.constraint(equalTo: widthAnchor),
        ])
    }
}

Contributor guide