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

Fix indentation on code blocks inside discussion elements #114

Merged

Conversation

samsymons
Copy link
Contributor

This PR fixes up an issue where code blocks were receiving inconsistent indentation.

The root cause here comes from the discussion in #113, where the text-indent CSS property was being applied to all code blocks, rather than just those outside of discussion elements.

My guess here is that text-indent should stay on all code blocks except those with the .discussion class, where it's not uncommon to have multi-line code blocks, so this PR sets text-indent to 0 and adjusts the padding accordingly to remove the padding-left.

I'm still learning the internals of SwiftDoc and currently dusting off years-old CSS knowledge, so give me a shout if this solution is off base! ❤️


Fixes #113.

Using `text-indent` will indent every line after the first, which makes sense for declaration code blocks, but not necessarily for multiline code blocks inside documentation.
@samsymons samsymons force-pushed the fix-discussion-block-code-indentation branch from 89aea05 to 128fd1b Compare May 17, 2020 23:41
@mattt
Copy link
Contributor

mattt commented May 17, 2020

Thanks for taking this on, @samsymons! At first glance, this looks right. I'll have a chance to try it out locally in the next day or two.

@mattt mattt self-requested a review May 19, 2020 13:09
Copy link
Contributor

@mattt mattt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2020-05-19 at 06 15 31

Confirmed that this is working as expected. Great job!

@mattt mattt merged commit 648c43d into SwiftDocOrg:master May 19, 2020
mattt added a commit that referenced this pull request May 19, 2020
@mattt
Copy link
Contributor

mattt commented May 19, 2020

😅 Whoops, I neglected to add a changelog entry for this. Added that with 5dafcb1.

Thanks again for your help on this, @samsymons!

@samsymons samsymons deleted the fix-discussion-block-code-indentation branch May 19, 2020 13:47
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 this pull request may close these issues.

Properly Outdent Code Blocks in Discussion
2 participants