Pet-project Blog built with Gatsby v3 and MDX
Requirements:
npm i
npm i -g gatsby-cli
gatsby --version
npm install -g npm@7.10.0
gatsby new gatsby-starter-default https://github.com/gatsbyjs/gatsby-starter-default
gatsby clean
gatsby develop
Code an HTML form into any page on your site, add a netlify attribute to the<form>
tag, and you’ll receive submissions in your Netlify dashboard.
HTML files are parsed directly at deploy time, so there’s no need for you to
make an API call or include extra JavaScript on your site.
<form
className="contact-form"
name="newsletter-submission"
netlify-honeypot="bot-field"
method="POST"
data-netlify="true"
action="/success"
>
<input
type="text"
name="name"
placeholder="Your name"
className="form-control"
required
/>
<input
type="email"
name="email"
placeholder="Your email"
className="form-control"
required
/>
<input type="hidden" name="bot-field" />
<input
type="hidden"
name="form-name"
value="newsletter-submission"
/>
<button type="submit" className="btn form-control submit-btn">
Subscribe
</button>
</form>
query MyQuery {
allMdx {
nodes {
frontmatter {
slug
}
}
}
}
import { MDXRenderer } from 'gatsby-plugin-mdx'
for body
content in template
query MyQuery {
categories: allMdx {
distinct(field: frontmatter___category)
}
}
function wrapRootElement to wrap App in MDX Provider, that allows to intercept the elements typed in MDX
make changes in gatsby-browser & gatsby-ssr with logic in root-mdx
import React from 'react'
import { MDXProvider } from '@mdx-js/react'
const components = {
h2: props => {
console.log(props)
return <h2 {...props}>{props.children}</h2>
},
}
export const wrapMDX = ({ element }) => (
<MDXProvider components={components}>{element}</MDXProvider>
)
<h2 title="true">random h2</h2>
package-lock.json
Netlify => Published deploy => Stop auto publishing => Publish Deploy
npm i gatsby-plugin-offline
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number
of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x ev
en if nothing is polyfilled.
Please, upgrade your dependencies to the actual version of core-js.ERROR
(node:3700) [DEP0148] DeprecationWarning: Use of deprecated folder mapping “./“ in the “exports” field module
resolution of the package at D:\projects\gatsby_03\node_modules\postcss-js\package.json.
Update this package.json to use a subpath pattern like “./*“.ERROR #98124 WEBPACK
Generating development JavaScript bundle failed
Can’t resolve ‘/srcpagespost.mdx?type=component’ in ‘D:\projects\gatsby_03\src\pages’
If you’re trying to use a package make sure that ‘/srcpagespost.mdx?type=component’ is installed.
If you’re trying to use a local file make sure that the path is correct.File: src\pages\post.mdx
0
failed Re-building development bundle - 2.369s
ERROR in ./src/pages/post.mdx 4:0-60
Module not found: Error: Can’t resolve ‘/srcpagespost.mdx?type=component’
in ‘D:\projects\gatsby03\src\pages’
@ ./.cache/_this_is_virtual_fs_path/$virtual/async-requires.js 315
@ ./.cache/app.js 17:0-52 30:0-86 32:27-40 30:0-86webpack compiled with 1 error
Process finished with exit code 1
Thanks for visiting The Markdown Guide!
This Markdown cheat sheet provides a quick overview of all the Markdown syntax elements.
It can’t cover every edge case, so if you need more information about any of these elements,
refer to the reference guides for basic syntax
and extended syntax.
These are the elements outlined in John Grubber’s original design document.
All Markdown applications support these elements.
bold text
italicized text
blockquote
code
These elements extend the basic syntax by adding additional features. Not all Markdown applications support these elements.
Syntax | Description |
---|---|
Header | Title |
Paragraph | Text |
{
"firstName": "John",
"lastName": "Smith",
"age": 25
}
Here’s a sentence with a footnote. [^1]
[^1]: This is the footnote.
term
: definition
The world is flat.