Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Markdown asset extension to core #1160

Closed
wants to merge 1 commit into from

Conversation

zzarcon
Copy link

@zzarcon zzarcon commented Apr 9, 2018

As requested on #970 this adds Markdown support to parcel core instead of having to use a plugin for it.

Please let me know if Im missing something! 馃拑

Closes #970

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Apr 9, 2018

Imo this is a tricky one to implement, what if someone wants to import markdown and expects html?

Perhaps something like this would be better?
Markdown file:

exports.html = ''; // Html version of the markdown
exports.md = ''; // The original markdown string

Import usage:

const {md, html} = require('./somefile.md');

If someone only uses the html, treeshaking will remove the md one and vice versa

Another usecase might be linking to a markdown file from html, should this resolve to a html file or a markdown file?:

<a href="./somepage.md"></a>

@zzarcon
Copy link
Author

zzarcon commented Apr 9, 2018

Good point about the html version! I think we can easily have both named exports if we use a markdown converter like https://github.com/showdownjs/showdown. We might need to do the html conversion on demand to avoid unnecessary work.

About

<a href="./somepage.md"></a>

I'd say we want to provide the html version, that's what I will expect, but I'm happy to see other approaches :)

I think we need to decide first on, before continue:

  • Which parser we want to use
  • Whats the default behavior for md links

thoughts?

@DeMoorJasper
Copy link
Member

@zzarcon Sounds good, we can always swap out the parser if it's not sufficient.
I think md links in html should transpile to html.

@zeakd
Copy link

zeakd commented May 12, 2018

Here's some markdown parsers

I think md should be transpile to html, too. But the problem is how parcel can pass renderer to MarkdownAsset. Without renderer options, MarkdownAssets would not be useful. So,, which is better way?

  • Pass renderer or other options to <link /> attribute
  • external Markdown options like .markdownrc.
  • else ?

@zeakd zeakd mentioned this pull request May 13, 2018
@devongovett
Copy link
Member

Going to close this. I think if we support markdown it should be more useful than just inlining the original string. For that, you can always use fs.readFileSync.

Feel free to open a PR that compiles markdown to HTML. Then maybe we can use something like #1528 to load it.

@devongovett devongovett closed this Jul 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants