- Notifications
You must be signed in to change notification settings - Fork54
Bring scrollytelling to your MDX
License
pomber/gatsby-waves
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
I'm not maintaining this project anymore, but I'm working on its spiritual successor:Code Hike
Bring scrollytelling to your mdx. Animate code, images, charts, maps and more as you scroll.
The MDX looks like this:
import { CodeWave } from "gatsby-theme-waves"<CodeWave>```py# some code```#Some markdown```py# more code```More markdown>and more```py# and more```- ok- that's enough</CodeWave>
You need a Gatsby site with MDX. For example, this is how you add gatsby-theme-waves to a site that usesgatsby-theme-blog:
Install the theme (and
deepmerge
for merging the theme styles)npm install --save gatsby-theme-waves deepmerge
Add the theme to your
gatsby-config.js
(at the end of the plugin list just in case)module.exports={plugins:["gatsby-theme-blog","gatsby-theme-waves"// <-- add this]};
Merge the styles: create or edit
src/gatsby-plugin-theme-ui/index.js
importwavesThemefrom"gatsby-theme-waves/src/gatsby-plugin-theme-ui/index";importblogThemefrom"gatsby-theme-blog/src/gatsby-plugin-theme-ui/index";importmergefrom"deepmerge";exportdefaultmerge(blogTheme,wavesTheme);
Import
CodeWave
and use it in any MDX fileimport { CodeWave } from "gatsby-theme-waves"<CodeWave>```py# some code```#Some markdown```py# more code```More markdown>and more```py# and more```- ok- that's enough</CodeWave>
Your set up should look likethis example.
By default the lines that changed between two consecutive code blocks will be highlighted. You can change it to highlight the line (and columns) you want:
```js 1:3,6// highlights line 1,2,3 and 6``````js 5[1,3:6],8// highlights:// columns 1,3,4,5 and 6 from line 5// and line 8```
- Import code from files
- Better custom code syntax highlighting using theme-ui
- More waves
- More docs
About
Bring scrollytelling to your MDX
Topics
Resources
License
Stars
Watchers
Forks
Packages0
Languages
- JavaScript100.0%