Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Properly Outdent Code Blocks in Discussion #113

Closed
mattt opened this issue Apr 1, 2020 · 5 comments · Fixed by #114
Closed

Properly Outdent Code Blocks in Discussion #113

mattt opened this issue Apr 1, 2020 · 5 comments · Fixed by #114

Comments

@mattt
Copy link
Contributor

mattt commented Apr 1, 2020

For example, this code block renders as:

Screen Shot 2020-04-01 at 11 00 26

@mattt mattt transferred this issue from SwiftDocOrg/swift-doc Apr 2, 2020
@samsymons
Copy link
Contributor

@mattt Near as I can tell, this appears to come from usage of text-indent to indent code blocks inside SwiftDoc.

My CSS is rusty, but text-indent appears to only indent the first line within an element, which would explain the strange behaviour here. I found that by replacing text-indent with an adjusted padding value locally, it looks better:

indentation

@mattt
Copy link
Contributor Author

mattt commented May 17, 2020

@samsymons You know what, you're absolutely right — this is a CSS issue, not a problem with the indentation normalization code itself. Thanks for saving me the trouble of trying to hunt that down!

My reason for the text-indent was to improve the readability of declaration code blocks, which often run onto subsequent lines (without indentation, it's unclear that subsequent lines are a continuation of the previous one). However, that CSS rule was too general, and applied to code blocks in documentation as well. That should be a straightforward change.

@samsymons
Copy link
Contributor

@mattt Ahh, that makes perfect sense, having the indentation inside declaration code blocks is definitely clearer. 😄

I'd be happy to open a PR against SwiftDoc which fixes this up!

@mattt
Copy link
Contributor Author

mattt commented May 17, 2020

I'd be happy to open a PR against SwiftDoc which fixes this up!

@samsymons That'd be great! If you don't mind, that'd be a big help. Please let me know if you have any problems at all getting setup locally for CSS development. Aside from me and @kaishin, I don't think anyone else has really touched that, so I'd be very interested to know if there's anything we missed in the documentation or tooling around that.

@mattt
Copy link
Contributor Author

mattt commented May 17, 2020

Moving this back over to swift-doc.

@mattt mattt transferred this issue from SwiftDocOrg/SwiftMarkup May 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants