Contentlayer with next/image

This page summarizes the projects mentioned and recommended in the original post on dev.to

SurveyJS - JavaScript Form Builder with No-Code UI & Built-In JSON Schema Editor
Add the SurveyJS white-label form builder to your JavaScript app (React/Angular/Vue3). Build complex JSON forms without coding. Fully customizable, works with any backend, perfect for data-heavy apps. Learn more.
surveyjs.io
featured
InfluxDB – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com
featured
  1. rehype

    HTML processor powered by plugins part of the @unifiedjs collective

    The next idea was to use normal markdown images and to place the images in the public folder. This eliminates the need for static import and treats our image like a remote image. But in order to make this work, we have to tell next/image the dimensions of the image. If we would use a static import for the image, the import magic would provide the dimensions for us. To pass the width and height to the image component we use a rehype plugin called rehype-img-size.

  2. SurveyJS

    JavaScript Form Builder with No-Code UI & Built-In JSON Schema Editor. Add the SurveyJS white-label form builder to your JavaScript app (React/Angular/Vue3). Build complex JSON forms without coding. Fully customizable, works with any backend, perfect for data-heavy apps. Learn more.

    SurveyJS logo
  3. rehype-img-size

    rehype plugin to set local image size properties to img tag.

    The next idea was to use normal markdown images and to place the images in the public folder. This eliminates the need for static import and treats our image like a remote image. But in order to make this work, we have to tell next/image the dimensions of the image. If we would use a static import for the image, the import magic would provide the dimensions for us. To pass the width and height to the image component we use a rehype plugin called rehype-img-size.

  4. remark

    markdown processor powered by plugins part of the @unifiedjs collective (by remarkjs)

    contentlayer uses remark to parse the markdown in an mdast. We can now use remark plugins to modify the mdast. Then rehype comes into play and converts the mdast into a hast. rehype plugins can now modify the hast. Finally the hast is converted into react components.

  5. mdast

    Markdown Abstract Syntax Tree format

    contentlayer uses remark to parse the markdown in an mdast. We can now use remark plugins to modify the mdast. Then rehype comes into play and converts the mdast into a hast. rehype plugins can now modify the hast. Finally the hast is converted into react components.

  6. hast

    Hypertext Abstract Syntax Tree format

    contentlayer uses remark to parse the markdown in an mdast. We can now use remark plugins to modify the mdast. Then rehype comes into play and converts the mdast into a hast. rehype plugins can now modify the hast. Finally the hast is converted into react components.

  7. sdorra.dev

    A blog about web development

    For a more complete example have a look at the source of this blog.

  8. contentlayer

    Contentlayer turns your content into data - making it super easy to import MD(X) and CMS content in your app

    My first reaction was to use MDX and use next/image just as in the example. But that means that we can't use normal markdown images and it turns out that this won't work with contentlayer. This wont work, because Next.js does some magic on the import of the static image. The object which gets returned by the import, contains not only a path to the image, it contains also the width and height, plus a very small version of the image for the blurred placeholder. This magic does not work if the MDX file is loaded with contentlayer, because contentlayer uses its own bundler, which does not know about the import magic for images.

  9. InfluxDB

    InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.

    InfluxDB logo
  10. sharp

    High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.

    Now that we have the path, we can use sharp to read the width and height of the image.

  11. React

    The library for web and native user interfaces.

    contentlayer uses remark to parse the markdown in an mdast. We can now use remark plugins to modify the mdast. Then rehype comes into play and converts the mdast into a hast. rehype plugins can now modify the hast. Finally the hast is converted into react components.

  12. Next.js

    The React Framework

    My first reaction was to use MDX and use next/image just as in the example. But that means that we can't use normal markdown images and it turns out that this won't work with contentlayer. This wont work, because Next.js does some magic on the import of the static image. The object which gets returned by the import, contains not only a path to the image, it contains also the width and height, plus a very small version of the image for the blurred placeholder. This magic does not work if the MDX file is loaded with contentlayer, because contentlayer uses its own bundler, which does not know about the import magic for images.

  13. mdx

    Markdown for the component era

    My first reaction was to use MDX and use next/image just as in the example. But that means that we can't use normal markdown images and it turns out that this won't work with contentlayer. This wont work, because Next.js does some magic on the import of the static image. The object which gets returned by the import, contains not only a path to the image, it contains also the width and height, plus a very small version of the image for the blurred placeholder. This magic does not work if the MDX file is loaded with contentlayer, because contentlayer uses its own bundler, which does not know about the import magic for images.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Developing GROWI Plug-ins (Remark Plug-ins)

    2 projects | dev.to | 19 Jul 2024
  • I built an Markdown editor using Next.js and TailwindCss 🔥

    5 projects | dev.to | 14 Nov 2023
  • How to integrate your blog with dev.to API Next.js 13

    5 projects | dev.to | 16 Feb 2023
  • Serving Docusaurus images with Cloudinary

    3 projects | dev.to | 25 Dec 2022
  • I created a Markdown Note-taking App (win, mac, linux) using react, focuses on simplicity

    2 projects | /r/webdev | 1 Oct 2022

Did you know that JavaScript is
the 3rd most popular programming language
based on number of references?