Centralized data layer for multiple content sources or frameworks. Dive deep into Valhalla

ContactSign Up for Free
Community Plugin
View plugin on GitHub


Embeds the content of a specified markdown file as HTML within another markdown file.


Embedding Files

For example, given the following project directory structure:


Example of contents in /examples/

## This is an example of an embedded markdown fragment.

The following markdown syntax is used to embed the contents of these files:

# Sample Markdown


The resulting HTML for the above markdown would look something like this:

<h1>Sample Markdown</h1>
<div class="markdown-fragment">
  <h2>This is an example of an embedded markdown fragment.</h2>


npm install --save gatsby-remark-embed-markdown

How to use

// In your gatsby-config.js
module.exports = {
  plugins: [
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
            resolve: "gatsby-remark-embed-markdown",
            options: {
              // Example code links are relative to this dir.
              // eg examples/path/to/file.js
              directory: `${__dirname}/examples/`,

If you are looking to embed markdown in a code block, look into the gatsby-remark-embed-snippet plugin.

© 2022 Gatsby, Inc.