Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(theme): restore styles for code blocks #1170

Merged
merged 1 commit into from
Aug 16, 2022
Merged

fix(theme): restore styles for code blocks #1170

merged 1 commit into from
Aug 16, 2022

Conversation

brc-dd
Copy link
Member

@brc-dd brc-dd commented Aug 15, 2022

fixes: #1169, fixes #1175

x-ref: #1152

@brc-dd brc-dd linked an issue Aug 15, 2022 that may be closed by this pull request
@brc-dd brc-dd requested a review from Jinjiang August 15, 2022 10:25
@brc-dd
Copy link
Member Author

brc-dd commented Aug 15, 2022

@Jinjiang Hi! Can you check if this doesn't causes any other UI issues? I have restored the styles to what we had before #1152 and modified them for .highlighted.

@Jinjiang
Copy link
Member

Jinjiang commented Aug 15, 2022

@brc-dd my bad 😅 thanks for pointing this out.

I'm still checking other use cases. So fat it looks great!

After trying a little bit, I found another simple way to solve this is having a outer padding + inner negative margin:
diff --git a/src/client/theme-default/styles/components/vp-doc.css b/src/client/theme-default/styles/components/vp-doc.css
index 84e9d08..1038045 100644
--- a/src/client/theme-default/styles/components/vp-doc.css
+++ b/src/client/theme-default/styles/components/vp-doc.css
@@ -312,6 +312,7 @@
 .vp-doc [class*='language-'] code {
   display: flex;
   width: max-content;
+  padding: 0 24px;
   min-width: 100%;
   flex-direction: column;
   line-height: var(--vp-code-line-height);
@@ -321,6 +322,7 @@
 }
 
 .vp-doc [class*='language-'] code .line {
+  margin: 0 -24px;
   padding: 0 24px;
 }

Just FYI. I'm still checking other use cases. 🙏

@brc-dd
Copy link
Member Author

brc-dd commented Aug 15, 2022

After trying a little bit, I found another simple way to solve this is having a outer padding + inner negative margin:

But with keeping display flex on code, we can't have empty spans in it, or can we? (newlines were getting ignored earlier)

@brc-dd brc-dd merged commit 2c89afb into main Aug 16, 2022
@brc-dd brc-dd deleted the fix/1169 branch August 16, 2022 05:20
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
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.

New lines are ignored in markdown code snippets in 1.0.0-alpha.5 UI inconsistencies with code blocks
2 participants