Please check if the PR fulfills these requirements
[x] The commit message follows our guidelines
[ ] Tests for the changes have been added (for bug fixes / features)
[x] Docs have been added / updated (for bug fixes / features)
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
FIXES:
images in markdown files under /pages just work:tm::copyright::registered:
pages can be authored directly as .md and .mdx in /pages, where NextJS will treat them as NextPage components
MDX is now supported
REGRESSIONS:
/pages/blog/index.tsx is removed and needs re-implemented
'next/previous' links on blogs are removed and needs re-implemented
Frontmatter is not being parsed, validated, or used
What is the current behavior? (You can also link to an open issue here)
MDX is not supported.
Blogs are transformed at run-time, which causes incompatibilities with Next/Image. Next/Image requires that either:
images be statically imported
height and width props be provided for remote images
What is the new behavior (if this is a feature change)?
Since it is not feasible to require content contributors to specify the height and width of each image, I've gone the 'static import' route by transforming markdown files as part of the bundling process using @mdx-js/loader and @next/mdx. This is only half of a solution, though; I also had to develop recma-next-static-images, a custom plugin used with @mdx-js/loader that fetches and caches images before transforming the output to use static imports for image src attributes.
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
Yes, see 'What changes does this PR introduce?', above.
Other information:
Please file any issues with recma-next-static-imageshere
closes #89
21 is not closed by this; the components of the blog (in src/features/blog/components/prose) are unstyled and result in content overflow. This could be handled by updating the layout to wrap blog pages in a scrollable container.
Please check if the PR fulfills these requirements
[x] The commit message follows our guidelines
[ ] Tests for the changes have been added (for bug fixes / features)
[x] Docs have been added / updated (for bug fixes / features)
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
FIXES:
/pages
just work:tm::copyright::registered:.md
and.mdx
in/pages
, where NextJS will treat them asNextPage
componentsREGRESSIONS:
/pages/blog/index.tsx
is removed and needs re-implementedWhat is the current behavior? (You can also link to an open issue here)
Next/Image
.Next/Image
requires that either:height
andwidth
props be provided for remote imagesWhat is the new behavior (if this is a feature change)?
Since it is not feasible to require content contributors to specify the height and width of each image, I've gone the 'static import' route by transforming markdown files as part of the bundling process using
@mdx-js/loader
and@next/mdx
. This is only half of a solution, though; I also had to developrecma-next-static-images
, a custom plugin used with@mdx-js/loader
that fetches and caches images before transforming the output to use static imports for imagesrc
attributes.Yes, see 'What changes does this PR introduce?', above.
recma-next-static-images
here closes #8921 is not closed by this; the components of the blog (in
src/features/blog/components/prose
) are unstyled and result in content overflow. This could be handled by updating the layout to wrap blog pages in a scrollable container.