Git Product home page Git Product logo

gatsby-waves's Introduction

Gatsby Theme Waves

Still experimental but you can give it a try

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>

Installation

You need a Gatsby site with MDX. For example, this is how you add gatsby-theme-waves to a site that uses gatsby-theme-blog:

  1. Install the theme (and deepmerge for merging the theme styles)

    npm install --save gatsby-theme-waves deepmerge
  2. 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
      ]
    };
  3. Merge the styles: create or edit src/gatsby-plugin-theme-ui/index.js

    import wavesTheme from "gatsby-theme-waves/src/gatsby-plugin-theme-ui/index";
    import blogTheme from "gatsby-theme-blog/src/gatsby-plugin-theme-ui/index";
    import merge from "deepmerge";
    
    export default merge(blogTheme, wavesTheme);
  1. Import CodeWave and use it in any MDX file

    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>

Your set up should look like this example.

Code Blocks

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
```

Coming Soon

  • Import code from files
  • Better custom code syntax highlighting using theme-ui
  • More waves
  • More docs

gatsby-waves's People

Contributors

0xflotus avatar jlengstorf avatar pomber avatar relequestual avatar swyxio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.