-
Notifications
You must be signed in to change notification settings - Fork 57
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
Font size configurable via markdown.preview.fontSize
#44
base: master
Are you sure you want to change the base?
Conversation
- The build script was updated to comment out the explicit `font-size: 16px;` for `.vscode-body`. - CSS was regenerated.
Change looks good but this will change the preview's style for a lot of users We currently try to match github's display of markdown content, even setting the max-width of the content to match how it looks on github:
markdown.preview.fontSize
I'd like to either:
What do you think? |
Good points. I was initially looking for a way to do this dynamically and was a bit surprised that this extension is just a set of CSS files (please bare with me, I'm completely new to VSCode development and didn't even know extensions can be code-less; BTW, this was the first time I opened a source of an extension and tried to do something; I loved the experience!). Opt-in sounds great to me but would that mean that this extension would need to become more complex? I'm not sure I'm capable to contribute code at this point... |
A non-technical solution could be to add a note to README that one should set |
I'm just worried that if we merge this change, suddenly a lot of people's markdown preview is going to look different and a good number of them will never see the note in the readme explaining how to fix it. Going away from github styling by default also sort of goes against the point of this extension Dynamic would require a little work but the code changes are not too terrible. We actually use to do it for this plugin. Here's the change that removed it: da1c0be#diff-b9cfc7f2cdf78a7f4b91a753d10865a2 Did you want to look into making this dynamic. Here's what would be required based on the old work:
|
Totally agree, this needs to be reworked. I'll see if I can find time to take a look at what you suggested, in any case, feel free to close this PR. Thanks for the great feedback and detailed instructions! |
Just a thought but if VSCode had a setting like On a Mac, I'd simply like to do a zoom gesture over a preview panel to zoom it independently from the rest of VSCode. This would allow me, in split mode, to make the left side (where I'm editing Markdown) for example 2/3 wide while preview would only be 1/3 of the width. If I could zoom out the preview, I'd achieve a situation where I still see the rendering roughly as it would be on GitHub, without line wrapping. |
This extension claims to support zooming the preview though at first sight, I see no related code to this in their codebase. |
I was hunting for this exact feature when I ran across this PR; I'd love to have this (the default size, while matching github, is too large for my tastes) |
This likely needs updating because of #70. |
Okay so we'd need to remove the .github-markdown-body {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
margin: 0;
color: var(--color-fg-default);
background-color: var(--color-canvas-default);
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";
font-size: 16px;
line-height: 1.5;
word-wrap: break-word;
} It's on L196 and the line would need to be commented out to make it work. |
I'd like to add my voice to those asking for this feature. Although you can get around it with custom CSS, as far as I understand you'd need to put that styles file in every workspace (or in a GitHub gist), so it's not as seamless as an extension. |
Resolves #30
It works by commenting out this line:
vscode-github-markdown-preview-style/github-markdown.css
Line 13 in 2452ef0
in which case the preview reacts to
markdown.preview.fontSize
nicely. For example, 10px:Font size 24:
I looked through the rest of the CSS for other instances of setting explicit pixel font sizes but they always seem to be overridden by an
em
rule rule which is good. For example, on line 265:vscode-github-markdown-preview-style/github-markdown.css
Lines 264 to 267 in 2452ef0
And then later on line 495:
vscode-github-markdown-preview-style/github-markdown.css
Lines 493 to 497 in 2452ef0
Fortunately, these two are in the right order so I think that just disabling
16px
in.vscode-body
is enough.