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

Code highlighting #243

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

Rukki13
Copy link
Contributor

@Rukki13 Rukki13 commented Apr 30, 2024

Fixes #211

Copy link
Member

@jdrueckert jdrueckert left a comment

Choose a reason for hiding this comment

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

The screenshot you shared in #211 indeed looks better.
Looking at the code I think this makes sense, but I'm not a front-end person, so I cannot be certain. Also, I'd like to test this out locally before merging. I'll try to find time to do that this weekend, not sure I will though, so apologies as it might take another week before I get to merge this.

@@ -22,6 +22,12 @@ export default class Blog extends React.Component {
const { date } = postNode.fields;
return (
<Layout title={post.title}>
<style jsx>{`
Copy link
Member

Choose a reason for hiding this comment

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

Sonar complains about this and I'm not familiar with this syntax. Can you tell me what this does / is supposed to do?

@jdrueckert
Copy link
Member

jdrueckert commented May 8, 2024

Tests out fine, but I'm still curious about that <style jsx> tag, especially as Sonar and eslint identify it as an issue.
@Rukki13 can you please explain the purpose and necessity of the jsx property to me?

Copy link

sonarqubecloud bot commented May 8, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@Rukki13
Copy link
Contributor Author

Rukki13 commented May 10, 2024

Hi, sorry for the late reply. The style jsx just makes every html element of the class "gatsby-highlight" bigger. I couldn't find another way of doing it from the settings. I think something somewhere is overriding the font size so i had to add the style jsx thing.

@jdrueckert
Copy link
Member

Hi, sorry for the late reply. The style jsx just makes every html element of the class "gatsby-highlight" bigger. I couldn't find another way of doing it from the settings. I think something somewhere is overriding the font size so i had to add the style jsx thing.

So we're using styled jsx here, I see.
According to their docs, we should be able to fix the ESLint problem in our .eslintrc.json via "settings": {"import/core-modules": ["styled-jsx/css"] }. Unfortunately for me this didn't do the trick locally... can you try on your end whether this works for you and resolves the error that is currently displayed when running yarn run lint:js?

If this doesn't work on your side either, I think we can make ESLint ignore the line via {/* eslint-disable-next-line react/no-unknown-property */} in a new line above the style tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve rendering of code blocks / code listings
2 participants