Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-remark-fenced-divs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-remark-fenced-divs

Gatsby remark plugin for adding pandoc fenced_divs in markdown

  • 1.0.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

gatsby-remark-fenced-divs

Adds fencedDivs blocks in markdown syntax tree produced by remark, and convert them to <div>s in html using remark-fenced-divs.

This plugin aims to imitate the comportment of the pandoc extension fenced_divs

You can create div blocks using three colons as separator. The opening fence should include at least one attribute used as class for the div.

Install

npm install --save gatsby-remark-fenced-divs

How to use

Currently, the remark-fenced-divs plugin don't use any option as it only imitate the pandoc extension.

plugins: [
  {
    resolve: `gatsby-transformer-remark`,
    options: {
      plugins: [
        ...
        "gatsby-remark-fenced-divs"
        ...
      ],
    },
  },
];

Use the following Markdown syntax to create div blocks in your file:

fenced divs pass single word attribute as a class for the div

::: my-class
Here is a paragraph.

And another.
:::::

HTML OUTPUT:

<div class="my-class">
<p>Here is a paragraph.</p>
<p>And another.</p>
</div>

fenced divs supports extended curly braces attributes

::::: {#special .sidebar num=3} 
Here is a paragraph.

And another.
:::::

HTML OUTPUT:

<div id="special" class="sidebar" data-num="3">
<p>Here is a paragraph.</p>
<p>And another.</p>
</div>

Fenced divs can be nested:

::: Warning ::::::
This is a warning.

::: Danger
This is a warning within a warning.
:::
::::::::::::::::::

HTML OUTPUT:

<div class="Warning">
  <p>This is a warning.</p>
  <div class="Danger">
    <p>This is a warning within a warning.</p>
  </div>
</div>

This will generate the following html:

<div class="custom-block danger">
  <div class="custom-block-body"><p>content</p></div>
</div>

<div class="custom-block info">
  <div class="custom-block-heading">This is a title!</div>
  <div class="custom-block-body"><p>content</p></div>
</div>

Keywords

FAQs

Package last updated on 24 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc