{"_id":"@bongnv/gatsby-transformer-remark","_rev":"1-321c9eebc78116aa9d36e1dcbb0851df","name":"@bongnv/gatsby-transformer-remark","dist-tags":{"latest":"2.8.0"},"versions":{"2.8.0":{"name":"@bongnv/gatsby-transformer-remark","description":"Gatsby transformer plugin for Markdown using the Remark library and ecosystem","version":"2.8.0","author":{"name":"Kyle Mathews","email":"mathews.kyle@gmail.com"},"bugs":{"url":"https://github.com/gatsbyjs/gatsby/issues"},"dependencies":{"@babel/runtime":"^7.9.2","bluebird":"^3.7.2","gatsby-core-utils":"^1.2.0","gray-matter":"^4.0.2","hast-util-raw":"^4.0.0","hast-util-to-html":"^4.0.1","lodash":"^4.17.15","mdast-util-to-hast":"^3.0.4","mdast-util-to-string":"^1.1.0","mdast-util-toc":"^5.0","remark":"^10.0.1","remark-parse":"^6.0.3","remark-retext":"^3.1.3","remark-stringify":"6.0.4","retext-english":"^3.0.4","sanitize-html":"^1.23.0","underscore.string":"^3.3.5","unified":"^6.2.0","unist-util-remove-position":"^1.1.4","unist-util-select":"^1.5.0","unist-util-visit":"^1.4.1"},"devDependencies":{"@babel/cli":"^7.8.4","@babel/core":"^7.9.0","babel-preset-gatsby-package":"^0.4.0","cross-env":"^5.2.1"},"homepage":"https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-transformer-remark#readme","keywords":["markdown","remark"],"license":"MIT","peerDependencies":{"gatsby":"^2.12.0"},"repository":{"type":"git","url":"git+https://github.com/gatsbyjs/gatsby.git","directory":"packages/gatsby-transformer-remark"},"scripts":{"build":"babel src --out-dir . --ignore \"**/__tests__\"","prepare":"cross-env NODE_ENV=production npm run build","watch":"babel -w src --out-dir . --ignore \"**/__tests__\""},"engines":{"node":">=10.13.0"},"main":"index.js","_id":"@bongnv/gatsby-transformer-remark@2.8.0","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-kGw7x3ijb2UYEnDgosn0GjHpF5wOTeaCfIeSX5ltr/IyfUyxuF2WwOo0Pl8rw0aYpqrcyC75l/hvHduHKNB5AA==","shasum":"f3f09b6694ad204e617d96c67a2aa02dbd2a33d7","tarball":"https://registry.npmjs.org/@bongnv/gatsby-transformer-remark/-/gatsby-transformer-remark-2.8.0.tgz","fileCount":12,"unpackedSize":68949,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJep26jCRA9TVsSAnZWagAA1kYP/1PvoopwTC27FKNhrRPQ\nCuJ3KJTrk5HAyBQpq6pNs0gwe5VZ9rrnaPLBUYOWJfPK3AoQqM+C14aA4O9t\nVzZXHXjlaTsE5jXb74Y7SZ/oLD8g+Wff9H1auJW6/rvbUj4OwVFPc5yPsB0o\n06ajeEsWkVg84bLbI7QjvbWI6Vo7EV2mArOOzl+EezJmon5IfNGsOIGG9VWS\ng6BlECk1k9QpONY8X3vClq/J7qN1ySuHWxIFfWLVUsDN0V4JJPP54bD6cq99\nz+Rny5M44Y0QDetdUK+nxNo3rLZMnLD6vfkCfYDpYMUShzXqsgS+H/4CZvZ9\n/CcViIh/sbNz1TCXNQOV39TVnHlKv/zzR9Yd3k8I6cV9JOBYVLH90bJ7PlGP\nWW5PlIIiefU5PFmVySXtBApd7QMp4y5JYzotXpsi2bGdEHoIJJPIsT0FpAlz\nvV3WeCtiLl7mtoxz9bRh0wSdsXHPavZp2Pzyy9JFerBmW3t4htgsbRlYXLkQ\n9IM4cYNRy7Ppybb2WYskJjHQv7uAyi/Skjc/2m6Ui6rYyceLmJdkt4wjbTEE\ncVIQ9bXp8DLqdRhRO0+pj83/sgFVINlsn/DsemF7CrIakZ12BtMw3bbUwoyz\nGz979BGsXQ85wz9xObruKXRZWKE0texd7dKmPaFUEGdyy5ZXBN4lyqxYQakZ\nWJIL\r\n=9kwz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAVzaBflDA58BWqT9QwGzY7VlSdXLkbVuV2cnSZaFXtkAiAZngmGN7ktEgeUGDQ9qLtqDb4eaVlY1d1ovG6xK8b9QA=="}]},"maintainers":[{"name":"bongnv","email":"vanbong@gmail.com"}],"_npmUser":{"name":"bongnv","email":"vanbong@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gatsby-transformer-remark_2.8.0_1588031139457_0.3484019376500831"},"_hasShrinkwrap":false}},"time":{"created":"2020-04-27T23:45:39.409Z","2.8.0":"2020-04-27T23:45:39.655Z","modified":"2022-04-04T20:06:14.237Z"},"maintainers":[{"name":"bongnv","email":"vanbong@gmail.com"}],"description":"Gatsby transformer plugin for Markdown using the Remark library and ecosystem","homepage":"https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-transformer-remark#readme","keywords":["markdown","remark"],"repository":{"type":"git","url":"git+https://github.com/gatsbyjs/gatsby.git","directory":"packages/gatsby-transformer-remark"},"author":{"name":"Kyle Mathews","email":"mathews.kyle@gmail.com"},"bugs":{"url":"https://github.com/gatsbyjs/gatsby/issues"},"license":"MIT","readme":"# gatsby-transformer-remark\n\nParses Markdown files using [Remark](http://remark.js.org/).\n\nThis is a fork of `gatsby-transformer-remark` to be populate `id` in `headings`.\n\n## Install\n\n`npm install --save @bongnv/gatsby-transformer-remark`\n\n## How to use\n\n```javascript\n// In your gatsby-config.js\nplugins: [\n  {\n    resolve: `gatsby-transformer-remark`,\n    options: {\n      // CommonMark mode (default: true)\n      commonmark: true,\n      // Footnotes mode (default: true)\n      footnotes: true,\n      // Pedantic mode (default: true)\n      pedantic: true,\n      // GitHub Flavored Markdown mode (default: true)\n      gfm: true,\n      // Plugins configs\n      plugins: [],\n    },\n  },\n],\n```\n\nThe following parts of `options` are passed down to Remark as options:\n\n- `options.commonmark`\n- `options.footnotes`\n- `options.pedantic`\n- `options.gfm`\n\nThe details of the Remark options above could be found in [`remark-parse`'s documentation](https://github.com/remarkjs/remark/tree/master/packages/remark-parse#processoruseparse-options)\n\nA full explanation of how to use markdown in Gatsby can be found here:\n[Creating a Blog with Gatsby](https://www.gatsbyjs.org/blog/2017-07-19-creating-a-blog-with-gatsby/)\n\nThere are many Gatsby Remark plugins which you can install to customize how Markdown is processed. Many of them are demoed at https://using-remark.gatsbyjs.org/. See also the [source code for using-remark](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-remark).\n\n## Parsing algorithm\n\nIt recognizes files with the following extensions as Markdown:\n\n- md\n- markdown\n\nEach Markdown file is parsed into a node of type `MarkdownRemark`.\n\nAll frontmatter fields are converted into GraphQL fields. TODO link to docs on\nauto-inferring types/fields.\n\nThis plugin adds additional fields to the `MarkdownRemark` GraphQL type\nincluding `html`, `excerpt`, `headings`, etc. Other Gatsby plugins can also add\nadditional fields.\n\n## How to query\n\nA sample GraphQL query to get MarkdownRemark nodes:\n\n```graphql\n{\n  allMarkdownRemark {\n    edges {\n      node {\n        html\n        headings {\n          id\n          depth\n          value\n        }\n        frontmatter {\n          # Assumes you're using title in your frontmatter.\n          title\n        }\n      }\n    }\n  }\n}\n```\n\n### Getting table of contents\n\nUsing the following GraphQL query you'll be able to get the table of contents\n\n```graphql\n{\n  allMarkdownRemark {\n    edges {\n      node {\n        html\n        tableOfContents\n      }\n    }\n  }\n}\n```\n\n### Configuring the tableOfContents\n\nBy default the tableOfContents is using the field `slug` to generate absolute URLs. You can however provide another field using the pathToSlugField parameter. **Note** that providing a non existing field will cause the result to be null. You can also pass `absolute: false` to generate relative path. To alter the default values for tableOfContents generation, include values for `heading` (string) and/or `maxDepth` (number 1 to 6) in graphQL query. If a value for `heading` is given, the first heading that matches will be omitted and the toc is generated from the next heading of the same depth onwards. Value for `maxDepth` sets the maximum depth of the toc (i.e. if a maxDepth of 3 is set, only h1 to h3 headings will appear in the toc).\n\n```graphql\n{\n  allMarkdownRemark {\n    edges {\n      node {\n        html\n        tableOfContents(\n          absolute: true\n          pathToSlugField: \"frontmatter.path\"\n          heading: \"only show toc from this heading onwards\"\n          maxDepth: 2\n        )\n        frontmatter {\n          # Assumes you're using path in your frontmatter.\n          path\n        }\n      }\n    }\n  }\n}\n```\n\nTo pass default options to the plugin generating the tableOfContents, configure it in gatsby-config.js as shown below. The options shown below are the defaults used by the plugin.\n\n```javascript\n// In your gatsby-config.js\nplugins: [\n  {\n    resolve: `gatsby-transformer-remark`,\n    options: {\n      tableOfContents: {\n        heading: null,\n        maxDepth: 6,\n      },\n    },\n  },\n]\n```\n\n### Excerpts\n\n#### Length\n\nBy default, excerpts have a maximum length of 140 characters. You can change the default using the `pruneLength` argument. For example, if you need 500 characters, you can specify:\n\n```graphql\n{\n  allMarkdownRemark {\n    edges {\n      node {\n        html\n        excerpt(pruneLength: 500)\n      }\n    }\n  }\n}\n```\n\n#### Format\n\nBy default, Gatsby will return excerpts as plain text. This might be useful for populating [opengraph](https://en.wikipedia.org/wiki/Facebook_Platform#Open_Graph_protocol) HTML tags for SEO reasons. You can also explicitly specify a `PLAIN` format like so:\n\n```graphql\n{\n  allMarkdownRemark {\n    edges {\n      node {\n        excerpt(format: PLAIN)\n      }\n    }\n  }\n}\n```\n\nIt's also possible to ask Gatsby to return excerpts formatted as HTML. You might use this if you have a blog post whose an excerpt contains markdown content--e.g. header, link, etc.--and you want these links to render as HTML.\n\n```graphql\n{\n  allMarkdownRemark {\n    edges {\n      node {\n        excerpt(format: HTML)\n      }\n    }\n  }\n}\n```\n\nYou can also get excerpts in Markdown format.\n\n```graphql\n{\n  allMarkdownRemark {\n    edges {\n      node {\n        excerpt(format: MARKDOWN)\n      }\n    }\n  }\n}\n```\n\n## gray-matter options\n\n`gatsby-transformer-remark` uses [gray-matter](https://github.com/jonschlinkert/gray-matter) to parse markdown frontmatter, so you can specify any of the options mentioned [here](https://github.com/jonschlinkert/gray-matter#options) in the `gatsby-config.js` file.\n\n### Example: Excerpts\n\nIf you don't want to use `pruneLength` for excerpts but a custom separator, you can specify an `excerpt_separator` in the `gatsby-config.js` file:\n\n```javascript\n{\n  \"resolve\": `gatsby-transformer-remark`,\n  \"options\": {\n    \"excerpt_separator\": `<!-- end -->`\n  }\n}\n```\n\nAny file that does not have the given `excerpt_separator` will fall back to the default pruning method.\n\n## Troubleshooting\n\n### Excerpts for non-latin languages\n\nBy default, `excerpt` uses `underscore.string/prune` which doesn't handle non-latin characters ([https://github.com/epeli/underscore.string/issues/418](https://github.com/epeli/underscore.string/issues/418)).\n\nIf that is the case, you can set `truncate` option on `excerpt` field, like:\n\n```graphql\n{\n  markdownRemark {\n    excerpt(truncate: true)\n  }\n}\n```\n\n### Excerpts for HTML embedded in Markdown files\n\nIf your Markdown file contains HTML, `excerpt` will not return a value.\n\nIn that case, you can set an `excerpt_separator` in the `gatsby-config.js` file:\n\n```javascript\n{\n  \"resolve\": `gatsby-transformer-remark`,\n  \"options\": {\n    \"excerpt_separator\": `<!-- endexcerpt -->`\n  }\n}\n```\n\nEdit your Markdown files to include that HTML tag after the text you'd like to appear in the excerpt:\n\n```markdown\n---\ntitle: \"my little pony\"\ndate: \"2017-09-18T23:19:51.246Z\"\n---\n\n<p>Where oh where is that pony?</p>\n<!-- endexcerpt -->\n<p>Is he in the stable or down by the stream?</p>\n```\n\nThen specify `MARKDOWN` as the format in your graphql query:\n\n```graphql\n{\n  markdownRemark {\n    excerpt(format: MARKDOWN)\n  }\n}\n```\n","readmeFilename":"README.md"}