July 26, 2020
yarn add gatsby-remark-code-titles
module.exports = {
plugins: [
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
`gatsby-remark-code-titles`,
];
}
],
};
.gatsby-code-title {
background: #999;
color: #eee;
margin: 24px 0px -24px;
padding: 6px 12px;
font-size: 0.8em;
line-height: 1;
font-weight: bold;
display: table;
border-radius: 4px 4px 0 0;
}
import "./src/styles/remark-code-title.css";
We can put a title if we write like this.
```js:title=index.js
// Insert your code
```
Then, we can see a title on a code block
Written by Yasuhiro Ito
Software engineer