Preventing linkdefinition labels from being lowercased. #601
-
I have the following setup to do some migration of my markdown files from https://hexo.io to https://nextjs.org. const contents = remark()
.use(gfm)
.use(stringify)
.use(frontmatter, "yaml")
.use(fixFrontmatter)
.use(textr, { plugins: [ellipses] })
.use(replaceVimeo)
.use(replaceCodeBlock)
.use(replaceBlockQuote)
.use(imgToJsx)
.use(prefixRelativeLinks, { prefix: "/blog" })
.processSync(fs.readFileSync(filePath))
.toString();
const formatted = prettier.format(contents, {
...prettierConfig,
parser: "mdx",
});
fs.writeFileSync(`${outputDir}/${slug}`, formatted); However prettier.format is causing my link labels to be lowercased. Is there any way to keep using prettier, but skip lowercasing the link labels? See below the diff caused by prettier line. I found prettier is using -[BlogLetsEncrypt]: /blog/ssl-certificate-for-your-azure-website-using-letsencrypt/ "Ssl certificates for your azure website using Letsencrypt"
-[BlogReactNginxHTTP2]: /blog/react-router-and-nginx-over-http2/ "React Router and Nginx over HTTP/2"
+[blogletsencrypt]: /blog/ssl-certificate-for-your-azure-website-using-letsencrypt/ "Ssl certificates for your azure website using Letsencrypt"
+[blogreactnginxhttp2]: /blog/react-router-and-nginx-over-http2/ "React Router and Nginx over HTTP/2"
-In my [previous blog][BlogReactNginxHTTP2] I have already shown you how to use self-signed certificates in Nginx to use HTTP/2 features. I have also written a blog a long time ago on [how to get a Letsencrypt certificate for your Azure website][BlogLetsEncrypt].
+In my [previous blog][blogreactnginxhttp2] I have already shown you how to use self-signed certificates in Nginx to use HTTP/2 features. I have also written a blog a long time ago on [how to get a Letsencrypt certificate for your Azure website][blogletsencrypt]. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
@marcofranssen this sounds like an XY Problem? |
Beta Was this translation helpful? Give feedback.
@marcofranssen this sounds like an XY Problem?
reference links are case insensitive https://spec.commonmark.org/0.29/#example-174, uppercase vs lowercase doesn't matter for the link being resolved.
Furthermore Remark/MDX are AST based, they will preserve document structure but they don't preserve exact syntax as a CST would.