parcel-plugin-markdown-string icon indicating copy to clipboard operation
parcel-plugin-markdown-string copied to clipboard

following README for getting HTML string didn't work for me

Open ultrasaurus opened this issue 2 years ago • 4 comments

I only got markdown when I was trying to get HTML. By putting console.log statements in the code, I noticed that the default config had:

{ marked: undefined, html: undefined }

I ended up just doing an asset transformation, which is what originally looking for. Would be nice if how to do that were more clearly explained in the README. Here's the example I came up with that seems to work for me: https://github.com/ultrasaurus/hello-parcel-markdown/tree/simple-asset-transform

basically, just needed to add .markedrc with

{
    "marked": true,
    "html": true
}

then `yarn parcel src/index.md`


ultrasaurus avatar Jul 02 '22 15:07 ultrasaurus

https://github.com/jaywcjlove/parcel-plugin-markdown-string/blob/64abbf6862b9148e651277bce6230f9189dc4b97/example/.markedrc#L1-L12

@ultrasaurus

jaywcjlove avatar Jul 02 '22 15:07 jaywcjlove

Another change that seems to be required is using the bundle-text: protocol to import the rendered markdown as a string:

import HTMLStr from 'bundle-text:./Markdown.md';

console.log(HTMLStr) // => Output HTML string.
document.body.innerHTML = HTMLStr;

comp500 avatar Nov 16 '22 14:11 comp500

This is the first time I see such an import, is there any documentation for my reference? @comp500

jaywcjlove avatar Nov 16 '22 14:11 jaywcjlove

~~See https://parceljs.org/features/bundle-inlining/#inlining-a-bundle-as-text~~

Nevermind, this isn't required. I'm not sure why it wasn't working before...

comp500 avatar Nov 16 '22 14:11 comp500