盖茨比评论图像不显示图像
gatsby remark images does not display image
我在其他地方看到过这个并且尝试了很多东西但无法让它为我工作。 .md body 照片不会通过 gatsby-remark-images 显示。我也已将所有内容更新到最新版本。
更新现在显示完整的配置文件
配置:
const path = require(`path`)
module.exports = {
siteMetadata: {
title: `xxx`,
description: `xxx`,
author: `xxx`,
},
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 1500,
withWebp: true,
showCaptions: true,
quality: 100,
},
},
`gatsby-transformer-sharp`,
`gatsby-transformer-remark`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `markdown-pages`,
path: `${__dirname}/src/markdown-pages`,
},
},
`gatsby-plugin-sharp`,
`gatsby-plugin-react-helmet`,
`gatsby-plugin-styled-components`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `white`,
theme_color: `white`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
],
}
md 内部:
![fail](../images/demo/fail.jpeg)
为了在 markdown 中使用默认的图像语法,您可以在 gatsby-transformer-remark
的选项中指定 gatsby-images-remark
插件,例如
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 1500,
withWebp: true,
showCaptions: true,
quality: 100,
},
},
],
},
},
查看 gatsby documentation 了解更多详情。
我在其他地方看到过这个并且尝试了很多东西但无法让它为我工作。 .md body 照片不会通过 gatsby-remark-images 显示。我也已将所有内容更新到最新版本。
更新现在显示完整的配置文件
配置:
const path = require(`path`)
module.exports = {
siteMetadata: {
title: `xxx`,
description: `xxx`,
author: `xxx`,
},
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 1500,
withWebp: true,
showCaptions: true,
quality: 100,
},
},
`gatsby-transformer-sharp`,
`gatsby-transformer-remark`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `markdown-pages`,
path: `${__dirname}/src/markdown-pages`,
},
},
`gatsby-plugin-sharp`,
`gatsby-plugin-react-helmet`,
`gatsby-plugin-styled-components`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `white`,
theme_color: `white`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
],
}
md 内部:
![fail](../images/demo/fail.jpeg)
为了在 markdown 中使用默认的图像语法,您可以在 gatsby-transformer-remark
的选项中指定 gatsby-images-remark
插件,例如
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 1500,
withWebp: true,
showCaptions: true,
quality: 100,
},
},
],
},
},
查看 gatsby documentation 了解更多详情。