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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@graviola/edb-markdown-renderer

v1.3.0

Published

A markdown renderer for json forms

Readme

@graviola/edb-markdown-renderer

A Markdown editor and renderer for JSON Forms in the Graviola framework.

Environment: Client

Overview

This package provides specialized JSON Forms renderers for editing and displaying Markdown content. It integrates with @uiw/react-md-editor to offer a rich Markdown editing experience with preview capabilities, making it ideal for description fields, documentation, and other text-heavy content.

Ecosystem Integration

Position in the Graviola Framework

The markdown-renderer package extends the form rendering capabilities of the Graviola framework by providing specialized components for Markdown content. It enables users to edit and preview Markdown directly within forms, enhancing the content authoring experience for rich text.

Dependency Graph

flowchart TD
    A[graviola/edb-markdown-renderer] --> B[graviola/edb-layout-renderer]
    A --> C[uiw/react-md-editor]
    A --> D[uiw/react-markdown-preview]
    A --> E[lodash-es]
    A --> F[rehype-sanitize]
    A --> G[rehype-external-links]
    A --> H[turndown]
    I[apps/exhibition-live] --> A

    style A fill:#f9f,stroke:#333,stroke-width:2px

Package Relationships

  • Dependencies:

    • @graviola/edb-layout-renderer: Provides layout components used by the markdown renderer
    • @uiw/react-md-editor: The core Markdown editor component
    • @uiw/react-markdown-preview: Used for previewing Markdown content
    • lodash-es: Provides utility functions
    • rehype-sanitize: Sanitizes HTML in Markdown preview for security
    • rehype-external-links: Adds target="_blank" to external links in Markdown preview
    • turndown: Converts HTML to Markdown when pasting content
  • Peer Dependencies:

    • next: Next.js framework for dynamic imports
    • @jsonforms/react, @jsonforms/core, @jsonforms/material-renderers: JSON Forms library
    • @mui/material, @mui/icons-material: Material UI components
    • react: React library

Installation

bun add @graviola/edb-markdown-renderer
# or
npm install @graviola/edb-markdown-renderer
# or
yarn add @graviola/edb-markdown-renderer

Features

  • MarkdownTextFieldRenderer: A JSON Forms renderer for Markdown text fields
  • MDEditor: A wrapper around @uiw/react-md-editor with dynamic importing for Next.js compatibility
  • MDEditorMarkdown: A wrapper around @uiw/react-markdown-preview for rendering Markdown
  • Toggle Between Edit and Preview: Users can switch between editing and previewing Markdown
  • HTML to Markdown Conversion: Automatically converts HTML to Markdown when pasting content
  • Security: Sanitizes HTML in Markdown preview to prevent XSS attacks
  • External Links: Automatically adds target="_blank" to external links in Markdown preview

Usage

Basic Usage with MarkdownTextFieldRenderer

To use the MarkdownTextFieldRenderer in your JSON Forms application:

import {
  MarkdownTextFieldRenderer
} from '@graviola/edb-markdown-renderer';
import { JsonFormsRendererRegistryEntry, rankWith, scopeEndsWith } from '@jsonforms/core';

// Create a renderer registry
const renderers: JsonFormsRendererRegistryEntry[] = [
  // Register the Markdown renderer for description fields
  {
    tester: rankWith(10, scopeEndsWith("description")),
    renderer: MarkdownTextFieldRenderer
  }
];

// Use the renderers with JsonForms
import { JsonForms } from '@jsonforms/react';

const MyForm = ({ data, schema, uischema, onChange }) => (
  <JsonForms
    data={data}
    schema={schema}
    uischema={uischema}
    renderers={renderers}
    onChange={onChange}
  />
);

JSON Schema Example

{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "title": "Title"
    },
    "description": {
      "type": "string",
      "title": "Description"
    }
  }
}

UI Schema Example

{
  "type": "VerticalLayout",
  "elements": [
    {
      "type": "Control",
      "scope": "#/properties/title"
    },
    {
      "type": "Control",
      "scope": "#/properties/description"
    }
  ]
}

Using MDEditor Directly

You can also use the MDEditor component directly in your React components:

import { MDEditor, MDEditorMarkdown } from "@graviola/edb-markdown-renderer";
import React, { useState } from "react";

const MyMarkdownEditor = () => {
  const [value, setValue] = useState<string>("# Hello, world!");
  const [editMode, setEditMode] = useState<boolean>(true);

  return (
    <div>
      <button onClick={() => setEditMode(!editMode)}>
        {editMode ? "Preview" : "Edit"}
      </button>

      {editMode ? (
        <MDEditor
          value={value}
          onChange={(newValue) => setValue(newValue || "")}
          previewOptions={{
            rehypePlugins: [
              [rehypeSanitize],
              [rehypeExternalLinks, { target: "_blank" }],
            ],
          }}
        />
      ) : (
        <MDEditorMarkdown
          source={value}
          rehypePlugins={[
            [rehypeSanitize],
            [rehypeExternalLinks, { target: "_blank" }],
          ]}
        />
      )}
    </div>
  );
};

Internal Usage

This package is used in the Graviola framework to render Markdown fields in applications like the exhibition-live app. Here's an example from the rendererRegistry.ts file:

// From apps/exhibition-live/components/config/rendererRegistry.ts
import { MarkdownTextFieldRenderer } from "@graviola/edb-markdown-renderer";

export const rendererRegistry: JsonFormsRendererRegistryEntry[] = [
  // ... other renderers
  {
    tester: rankWith(10, scopeEndsWith("description")),
    renderer: MarkdownTextFieldRenderer,
  },
];

API Reference

MarkdownTextFieldRenderer

A JSON Forms renderer for Markdown text fields.

Features

  • Toggle between edit and preview modes
  • HTML to Markdown conversion when pasting content
  • Security sanitization for Markdown preview
  • External links open in new tabs

MDEditor

A wrapper around @uiw/react-md-editor with dynamic importing for Next.js compatibility.

Props

Inherits all props from @uiw/react-md-editor.

MDEditorMarkdown

A wrapper around @uiw/react-markdown-preview for rendering Markdown.

Props

Inherits all props from @uiw/react-markdown-preview.

License

This package is part of the Graviola project.