jeffrafter / gatsby-remark-tufte

Converts sidenotes and margin notes as well as figures to output for use with tufte-css using markdown.
MIT License
5 stars 3 forks source link

Build fails with Missing parser, cannot attach `remark-figure` #5

Open AndyAyrey opened 3 years ago

AndyAyrey commented 3 years ago

Hi there!

I'm attempting to generate a site based off some Markdown files with footnotes, but no figures. Example Markdown File: model-legislation-chapter-1.md

gatsby build fails with the following logs.

Missing parser, cannot attach `remark-figure`
ERROR There was an error in your GraphQL query:
   1 | query usrsrcappwwwsrcpagesMarkdownRemarkFrontmatterSlugJs1238545120($id: String!) {
   2 |   markdownRemark(id: {eq: $id}) {
>  3 |     html
   4 |     frontmatter {:
     |     ^
   5 |       date(formatString: "MMMM DD, YYYY")
   8 |     }
   6 |       slug
  10 | }
   7 |       title
  11 |
   9 |   }
Plugin: none
Url path: /definitions/
File path: /usr/src/app/www/src/pages/{MarkdownRemark.frontmatter__slug}.js

From what I can tell, the query is fine, and build proceeds correctly if I comment out the following lines in index.js of gatsby-remark-tufte:

"use strict";

const sidenotes = require("./src/remark-sidenotes-transformer")();
const wrapInSection = require("./src/wrap-in-section-transformer")();
// const tufteFigureTransformer = require("./src/remark-figure-transformer")();
// const tufteFigureParser = require("./src/remark-figure-parser");

module.exports = ({ markdownAST }, pluginOptions = {}) => {
    try {
        sidenotes(markdownAST);
    } catch (error) {
        console.error("Error applying sidenotes: ", error);
    }
    wrapInSection(markdownAST);
    // tufteFigureTransformer(markdownAST);

    return markdownAST;
};

// module.exports.setParserPlugins = (options) => {
//   return [[tufteFigureParser]];
// };
AndyAyrey commented 3 years ago

Interim solution for those who don't need figure support, a fork with the remark-parse dependency removed.

yarn add Zygar/gatsby-remark-tufte