Giter VIP home page Giter VIP logo

Comments (2)

eyelidlessness avatar eyelidlessness commented on April 28, 2024

RE: pages, I think a good compromise is to use the getStatic* methods on a template page, to collect pages/paths and pre-render/pass to props. I have a similar setup for a project I’m working on (though I wish I’d known about xdm sooner!) and it’s working out well.

from microsite.

ratorx avatar ratorx commented on April 28, 2024

Thanks for adding markdown support! A few of thoughts:

  • I don’t like the inflexibility of always wrapping the Markdown in an article. Is it possible for the default component to return just the rendered markdown, and then let the user decide what to wrap it in? I realise that not wrapping raw HTML is a surprisingly hard problem because of upstream limitations (fragments don’t support dangerouslysetinnerhtml...), so a workaround might be to use something like preact-markup?
  • I think adding some Typescript could improve the API a bit. Instead of returning a HTML string, the API could return a special markdown object (which internally could be e.g. a branded string) and then Article (or equivalent could consume the special type rather than just a string? It would be really nice to have a special type for markdown, especially if there are already a lot of string props, and it would get a bit more type safety if Article could only consume markdown rather than any string.
  • Is it possible to have both renderToString as well as Markdown import support (not having pages support is fine, but I want to be able to treat MDX like JS) via a Snowpack plugin? Not a big deal, but treating Markdown as a first-class citizen, rather than “hardcode” (to some extent) the import path would be really nice. One minor (actual) usability benefit would be typescript import completions (rather than relying on the editor to have path completions) and aliases.

EDIT: A quick additional note on why 3 would be really nice to have as part of this project. I haven’t managed to get MDX imports working at all for various reasons. The biggest one (when trying xdm) is that snowpack uses CJS config, whilst xdm is ESM. However, this project is ideally placed to import ESM code for use in Snowpack plugins since it interacts directly with the Snowpack API. I don’t think this is a compelling reason, because this is entirely a Snowpack issue (not supporting mjs config), but it would be really nice if Microsite could make MDX just work.

from microsite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.