Giter VIP home page Giter VIP logo

gridsome-plugin-remark-codetitle's Introduction

gridsome-plugin-remark-codetitle

Adds a code title to code snippets

example

Install

npm install gridsome-plugin-remark-codetitle --save-dev

Settings

in your gridsome-config.js

...
transformers: {
    //Add markdown support to all file-system sources
    remark: {
      ...
      plugins: [
          ...
          ['gridsome-plugin-remark-codetitle', {
              className:'your-custom-class-name'
              }], // IMPORTANT: this must be ahead of other plugins that use code blocks
          '@gridsome/remark-prismjs'
          ...
      ]
    }
  }

Usage in Markdown

in your Markdown content

```js:title=example-file.js
const visit = require('unist-util-visit');
```js

This plug-in analyzes Markdown Tree and converts it into the following structure.

<div class="gridsome-code-title"><span>example-file.js</span></div>
```js
const visit = require('unist-util-visit');
```

Add CSS

The following is an example of using solarized for prism.js style.

.gridsome-code-title {
    display: block;
    position: relative;
    background: #fffbf3;
    width: 100%;
    top: 10px;
    border-top-left-radius: 0.3em;
    border-top-right-radius: 0.3em;
  }
  
  .gridsome-code-title span {
    display: inline;
    position: relative;
    font-size: .85em;
    font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
    color: #232129;
    background: rgb(247, 223, 30);
    border-top-left-radius: 0.3em;
    border-bottom-right-radius: 0.3em;
    padding: 3px;
    top: 1px;
  }

gridsome-plugin-remark-codetitle's People

Contributors

davidcouronne avatar

Watchers

 avatar  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.