npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

solid-markdown

v2.0.14

Published

Markdown renderer for solid-js

Downloads

14,944

Readme

solid-markdown

Render markdown as solid components.

The implementation is 90% shamelessly copied from https://github.com/remarkjs/react-markdown.

Changes include:

  • Replacing React specific component creation with SolidJS components
  • Porting the implementation from javascript with JSDoc types to typescript

Please check the original repo for in-depth details on how to use.

Installation

npm install solid-markdown

Usage

import { SolidMarkdown } from "solid-markdown";

const markdown = `
# This is a title

- here's
- a
- list
`;
const App = () => {
  return <SolidMarkdown children={markdown} />;
};

Rendering strategy

There's an extra option you can pass to the markdown component: renderingStrategy: "memo" | "reconcile".

The default value is "memo", which means that the markdown parser will generate a new full AST tree each time (inside a useMemo), and use that. As a consequence, the full DOM will be re-rendered, even the markdown nodes that haven't changed. (Should be fine 90% of the time).

Using reconcile will switch the strategy to using a solid store with the reconcile function (https://docs.solidjs.com/reference/store-utilities/reconcile). This will diff the previous and next markdown ASTs and only trigger re-renders for the parts that have changed. This will help with cases like streaming partial content and updating the markdown gradually (see https://github.com/andi23rosca/solid-markdown/issues/32).

<SolidMarkdown renderingStrategy="reconcile" children={markdown} />;

TODO

  • [ ] Port unit tests from from original library