catalog icon indicating copy to clipboard operation
catalog copied to clipboard

Importing Markdown into markdown Template Literal

Open mattfelten opened this issue 5 years ago • 0 comments

So I'm trying to publish our CHANGELOG.md file as a page on our site. I'm using lerna-changelog to almost-automatically generate our changelogs on each release. The trouble is that it uses an :emoji: character instead of the actual unicode emoji character in the headings. GitHub parses these fine, but importing the markdown file straight into Catalog doesn't convert them.

No problem! I say. I could make a React page that imports the markdown file, runs a search and replace, and then display it within a markdown template literal. Easy.

The only issue is I can't figure out how to actually do that. I'm struggling to get the markdown imported. Ideas I've had that don't work:

  • Importing as module. import * as changelog from './CHANGELOG.md';
  • Straight const changelog = require('./CHANGELOG.md');
  • Using pageLoader. const changelog = pageLoader(() => import('./CHANGELOG.md'));

I'm worried that I might need to change something about the webpack config to support this, but I don't really know what I'd need to do. Any advice?

mattfelten avatar Jan 24 '19 22:01 mattfelten