Transform tagged Markdown string to HTML during build time.

Overview

tagged-md

Transform tagged Markdown string to HTML!

Check out the examples!

Motivation

Have you ever written HTML strings in your JavaScript code? It's usually needed for adding formatted strings. However, writing raw HTML tags in string literal is inconvenient and typo-prone. It would be much better if we could use Markdown directly in those strings. But, if you just write strings in Markdown and transform them into HTML at runtime, you should include a Markdown parser in your application bundle! That's not good for both loading and computing performance. Wouldn't it be better to transform them into HTML at build time? tagged-md is made for exactly that purpose.

Installation

tagged-md requires installing both the main package, and the plugin that integrates with transpilers.

Currently, the following plugins are available:

If you need plugins for other transpilers, please create an issue for it!

Install the main package, and the plugin of your choice.

npm install -D tagged-md swc-plugin-tagged-md    # using npm and swc
yarn add -D tagged-md swc-plugin-tagged-md       # using yarn and swc
pnpm install -D tagged-md swc-plugin-tagged-md   # using pnpm and swc

Usage

First, make sure to configure the plugin you've installed by following each plugin's documentation.

You may write Markdown string literals like this:

import { md } from "tagged-md";

const content = md`
# Hello, world!

This content will be transformed into HTML **during build time.**
`

You can also apply Markdown configurations (like using GitHub-flavored Markdown) per each string literal.

import { md } from "tagged-md";

const issueBody = md({ gfm: true })`
# Tasks

- [x] Install tagged-md
- [ ] Write contents
`

Then the plugin will transform them into HTML while transpiling!


Packages under portone-io/tagged-md are primarily distributed under the terms of both the Apache License (Version 2.0) and the MIT license. See COPYRIGHT for details.

You might also like...
Rushes are new ephemeral projects at Hive Helsinki. Wordle is the first in this series with 48 hours time window

Rushes are new ephemeral projects at Hive Helsinki. Wordle is the first in this series with 48 hours time window

A first-time implementation of Conway's Game of Life in Rust: Adventure and Commentary

A Commentary on Life This project documents the process and final result of my first-ever attempt at implementing Conway's Game of Life. I'll be using

First-person 3D pong ray-traced on CPU in real time.

ray ten Run in browser ray-ten.mp4 Reimagining of a 1986 ZX Spectrum game room ten made with ray tracing. Completely ignoring GPUs when rendering 3D g

A real-time raytracing engine, with extra Bevy integration
A real-time raytracing engine, with extra Bevy integration

strolle Strolle (from strålspårning) is a real-time raytracing engine written entirely in Rust, running on CPU & GPU: It comes integrated with Bevy, b

Cross-platform GPU-accelerated viewer for the Mandelbrot set and similar (escape-time) fractals

fractal_viewer A cross-platform, GPU-accelerated viewer for the Mandelbrot Set and related fractals. Try it online! Usage Scroll wheel to zoom, click

Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.
Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.

Rust Embed Rust Custom Derive Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev. Y

The simplest build-time framework for writing web apps with html templates and typescript

Encoped A build-time fast af tool to write static apps with html and TypeScript Features Template-based ESLint, Prettier and Rollup integration No ext

Tools - The Rome Toolchain. A linter, compiler, bundler, and more for JavaScript, TypeScript, HTML, Markdown, and CSS.
Tools - The Rome Toolchain. A linter, compiler, bundler, and more for JavaScript, TypeScript, HTML, Markdown, and CSS.

Rome is currently being rewritten in Rust. Read more about it in our latest blog post. The documentation below is out of date and available for poster

Converts books written in Markdown to HTML, LaTeX/PDF and EPUB

Crowbook Crowbook's aim is to allow you to write a book in Markdown without worrying about formatting or typography, and let the program generate HTML

A Markdown to HTML compiler and Syntax Highlighter, built using Rust's pulldown-cmark and tree-sitter-highlight crates.

A blazingly fast( possibly the fastest) markdown to html parser and syntax highlighter built using Rust's pulldown-cmark and tree-sitter-highlight crate natively for Node's Foreign Function Interface.

A Faster(⚡)  formatter, linter, bundler, and more for JavaScript, TypeScript, JSON, HTML, Markdown, and CSS Lapce Plugin
A Faster(⚡) formatter, linter, bundler, and more for JavaScript, TypeScript, JSON, HTML, Markdown, and CSS Lapce Plugin

Lapce Plugin for Rome Lapce-rome is a Lapce plugin for rome, The Rome is faster ⚡ , A formatter, linter, compiler, bundler, and more for JavaScript, T

🏭 Convert Markdown documents into themed HTML pages with support for code syntax highlighting, LaTeX and Mermaid diagrams.
🏭 Convert Markdown documents into themed HTML pages with support for code syntax highlighting, LaTeX and Mermaid diagrams.

Marky Markdown Magician 🧙 Features Hot reload previewing 🔥 Conversion to HTML / PDF 🏭 Themes! ✨ Extensions - Math, diagrams, syntax-highlighting 🧩

Markdown to HTML converter written in Rust. Inspired by Katsuki Yuri's Makudaun Tool.
Markdown to HTML converter written in Rust. Inspired by Katsuki Yuri's Makudaun Tool.

Makurust Makurust is a powerful tool written in Rust that allows you to effortlessly convert your Markdown files into static HTML pages. Inspired by T

LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.

LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values. Authors: Sanjay Ghem

An annotated string type in Rust, made up of string slices

A string type made up of multiple annotated string slices.

`rusty_regex` takes an input string and produces a `regex` string representing what was provided.

rusty_regex This project provides a binary that takes an input string, and preps it for regex usage, effectively replacing known generics and producin

Like jq, but for HTML. Uses CSS selectors to extract bits content from HTML files.

Like jq, but for HTML. Uses CSS selectors to extract bits content from HTML files. Mozilla's MDN has a good reference for CSS selector syntax.

Distribute a wasm SPA as HTML by wrapping it as a polyglot "html+wasm+zip"

A packer that adds a webpage to WASM module, making it self-hosted! Motivation At the moment, Browsers can not execute WebAssembly as a native single

mn is my project to learn rust, I will try to build a markdown editor

med is a markdown editor This is my project to learn rust programming language, I will try to build a powerful markdown editor. Highlight: Support Vim

Owner
PortOne
코드 한 줄로 세상 모든 결제를 한 번에 연동, 통합 결제 솔루션 포트원
PortOne
Rust implementations of Fast Fourier Transform convolution and correlation for n-dimensional arrays

fftconvolve Rust implementations of Fast Fourier Transform convolution and correlation for n-dimensional arrays Examples 1-dimensional use fftconvolve

Rhys Newell 33 Jan 5, 2023
Rust-lang Continuous Wavelet Transform(CWT) library inspired by fCWT.

fastcwt Rust-lang Continuous Wavelet Transform(CWT) library inspired by fCWT. This crate is a direct translation of fCWT Library written in C++ by Art

null 3 May 2, 2023
String processing with file/line/col information and the regular rust `str` API

Simple span handling for str and &[u8] This crate exposes some of the methods that exist on str or bstr. If you are missing any you need, please open

Oli Scherer 3 Oct 30, 2023
State of the art "build your own engine" kit powered by gfx-hal

A rendering engine based on gfx-hal, which mimics the Vulkan API. Building This library requires standard build tools for the target platforms, except

Amethyst Foundation 801 Dec 28, 2022
"putzen" is German and means cleaning. It helps keeping your disk clean of build and dependency artifacts safely.

Putzen "putzen" is German and means cleaning. It helps keeping your disk clean of build and dependency artifacts safely. About In short, putzen solves

Sven Assmann 2 Jul 4, 2022
Rapidly iterate and build Bevy UI's with existing web-based technologies

bevy_webview WIP   Rapidly iterate and build Bevy UI's with existing web-based technologies It is currently very early days of this plugin - only Linu

Mika 30 Jan 4, 2023
An asset that provides 2d collision detector and kinematics, build from scratch in bevy

Busturi A physics engine An asset that provides 2d collision detector and kinematics, build from scratch in bevy How to use Add PhysicsPlugin to the p

NemuiSen 2 Jun 22, 2022
Dark Forest, the world's first decentralized real-time strategy game.

darkforest-rs Dark Forest, the world's first decentralized real-time strategy game.

null 44 Oct 9, 2022
Rust SDK for working with RIS-Live real-time BGP data stream.

ris-live-rs Provides parsing functions for RIS-Live real-time BGP message stream JSON data. The main parsing function, parse_ris_live_message converts

BGPKIT 10 Oct 11, 2022
My first Real-Time 3D Game Engine learning project written in Rust.

EyeEngine-Rust FOA, sry for my poor English. What is Eye Engine? Eye Engine is my first Real-Time 3D Game Engine learning project. There are two editi

F-seeeye 4 Jan 5, 2022