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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,34 @@ module.exports = {
wrapperStyle: `left:0; width: 100%;`,
},
},
"gatsby-remark-prismjs",
{
resolve: "gatsby-remark-prismjs",
options: {
additionalStyles: {
".gatsby-highlight": {
fontSize: "50px", // Set the desired font size
},
},
// Customize Prism options here
classPrefix: "language-", // Prefix for CSS classes added to code blocks
inlineCodeMarker: "`", // Marker for inline code snippets
showLineNumbers: true, // Whether to show line numbers
languageExtensions: [
{
language: "superscript",
extend: "javascript",
definition: {
superscript_types: /(SuperType)/,
},
insertBefore: {
function: {
superscript_keywords: /(superif|superelse)/,
},
},
},
],
},
},
"gatsby-remark-copy-linked-files",
"gatsby-remark-autolink-headers",
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@
"remark-preset-lint-recommended"
]
}
}
}
1 change: 1 addition & 0 deletions src/components/modules/ModuleCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "reactstrap";
import { GatsbyImage, getImage } from "gatsby-plugin-image";
import Tags from "../common/Tags";
import "prismjs/themes/prism.css";

function ModuleCard({ title, cover, tags, description, url }) {
return (
Expand Down
6 changes: 6 additions & 0 deletions src/templates/Blog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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?

.gatsby-highlight {
font-size: 15px;
color: red;
}
`}</style>
<div>
<div>
<div className="title">
Expand Down
Loading