1.1.5 • Published 3 years ago

react-markdown-to-matrix v1.1.5

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

React Markdown-To-Matrix

This library creates an embeddable React application that will transform a specified markdown file into a matrix form, with H2s being turned into rows and H3s turned into columns. This also looks for differences between items and optionally highlights those differences.

Installation

Run yarn add react-markdown-to-matrix or npm install react-markdown-matrix to add to an existing React app.

You will then be able to use the <MarkdownToMatrix> component:

import { MarkdownToMatrix } from 'react-markdown-to-matrix';

export const App: React.FC = () => {
    return(
        <MarkdownToMatrix 
            title='Markdown-To-Matrix'
            enabledOptions={['diff', 'filters', 'displayMode', 'upload']}
        />
    );
};

Options

There are a variety of configuration options available within the MarkdownToMatrix component:

ParameterTypeRequired?Description
enabledOptionsstring[]RequiredThe options to enable in the sidebar (see below)
titlestringOptionalThe title to display in the sidebar
subtitlestringOptionalThe subtitle to display in the sidebar
fileUrlsstring[]OptionalIf provided, the files to preload into the matrix view
customThemeThemeOptionalStyle overrides for colors and fonts
defaultMode'matrix''list'OptionalWhat view mode to start with; defaults to 'matrix'
renderHtmlbooleanOptionalSet to true to render inline HTML within the loaded markdown
excludeHeadersstring[]OptionalAny H2s / H3s that shouldn't be parsed into headers can be specified here

enabledOptions

There are four available options to enable or disable within the enabledOptions parameter.

  • 'upload' : allows users to upload their own markdown files to this view
  • 'filters' : allows users to hide rows or columns
  • 'diff' : allows users to view a diff view of elements in the grid
  • 'displayMode' : allows users to toggle between list and matrix view

If an empty string is provided, the sidebar is entirely hidden from the usesrs (which may be better for embedding). In this case, a set of urls for fileUrls must be provided.

customTheme

You can update a variety of aspects about how the app displays through the properties on the customTheme parameter. All fields are optional. All colors are expected to be specified as six-digit hex colors, including the # at the beginning.

Theme PropertyTypeDescription
darkHexColorThe dark color to use for the foregrouund
lightHexColorThe light color to use for the background
darkThemeHexColorA complementary dark color; used for the sidebar
lightThemeHexColorA complementary light color; used for hovers
bodyFontFontFamilyThe font to use for all body text
headerFontFontFamilyThe font to use for all header text
isDarkModebooleanIf true, reverses when light and dark colors are used

Source

The source for this library is avilable at github.com/kipprice/markdown-matrix. You can see a working version of this library at kipprice.github.io/markdown-matrix.

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

0.0.5

4 years ago

1.0.0

4 years ago