Skip to content

Add support for custom markdown delimitors #2

Open
@jamessimone

Description

@jamessimone

Currently there's no way for this plugin to play nice with another code formatting plugin. Because prism.js is so popular within the Gatsby community (I use it myself on my own tech blog), it would be nice to give people the option of using either custom html/markdown tags to inject codefence snippets into their markdown, e.g. [codefence] your code here [/codefence]

I've left the pluginOptions object exposed within the source code for this reason.

If you are looking to contribute, I would expect a PR addressing this issue to add, at a minimum:

  1. A test for the existing (vanilla) implementation's output when the triple backtick code formatting block is applied
  2. Implementation of custom markdown delimiter to be passed by the plugin options to the "visit" function so that nodes matching the delimiter are correctly identified
  3. Customization of the existing formatCodeFenceHTML function so that it correctly produces code fence HTML regardless of what is passed to it
  4. A test for this update

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions