Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte-render-md

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-render-md

A library that allows reading of yaml frontmatter from a .md file and rendering the md content as html. MD conversion done using Showdown and YAML parsing done using yaml-js. ## Usage ### Read YAML Frontmatter ``` import { parseContent } from "svelte-rend

  • 0.0.6
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

svelte-render-md

Description

A library that allows reading of yaml frontmatter from a .md file and rendering the md content as html. MD conversion done using Showdown and YAML parsing done using yaml-js.

Usage

Read YAML Frontmatter

import { parseContent } from "svelte-render-md";
let mdContent = "---\n
name: 'test'\n
description: 'This is a test'\n
---\n
# Test\n
This is to test the content parser\n";
let content = parseContent(mdContent);
let frontmatter = content.frontmatter;

Render md as HTML

You can render any md string as html:

<script>
  import { RenderHTML } from "svelte-render-md";
</script>

<RenderHTML mdString="# Test String\n This is to test" />

Combine the two to render file content as html and retrieve frontmatter:

<script>
  import { RenderHTML, parseContent } from "svelte-render-md";
  let mdContent = "---\n
  name: 'test'\n
  description: 'This is a test'\n
  ---\n
  # Test\n
  This is to test the content parser\n";
  let content = parseContent(mdContent);
  let frontmatter = content.frontmatter;
  let mdStr = content.content;
 </script>
 
 <RenderHTML mdString={mdStr} />

FAQs

Package last updated on 11 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc