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

@lazyemail/markdown-to-email

v3.0.2

Published

Translate 'Markdown' Syntax into HTML For Email Newsletters

Downloads

2

Readme

Gitpod ready-to-code

This simple and light tool generates email template from markdown. The command is npm run dev:parseFull. The path to markdown file must be ./source/source.md, and output directory is generated/newEmail.html.

How to run this module

There are two modes development and production. In development mode all changes that was made automatically rebuilds and creates a file html or js. Development mode has two variants:

npm run dev:parseFull - runs parsing from Markdown to html.

npm run dev:parseReactFull - runs parsing from Markdown to React DOM tree.

In production mode builds an optimized module. Production mode has two options:

npm run prod:parseFull and prod:parseReactFull.

Debugging the module

In VS Code needs to open a tab "Run and Debug", then in select input choose Launch via NPM parseFull - for html and Launch via NPM parseReactFull, the process will start automatically (builds and create a file). Put a breakpoint in line you need then save a file.

if you need help with markdown - Great Online Preview tool https://dillinger.io/

Syntax

Parser uses no libraries, so it copies markdown syntax and based on opening tag generates email component (image, paragraph, subtitle, etc.). There is a list of existing tags:

Subject

#!

The subject of email, will be displayed in the email preview.

Preview text

#~

Preview text of email, will be displayed in the email preview.

Title

#

Title of email, by default at the top of email body.

Subtitle

##

Subtitle, can be seen anywhere in email body.

Sponsorship

~[content][href][src]

The first symbol should be tilde ~, and all other attributes should be not empty, or this will cause errors. src - absolute path to image or may be url, href - the link of sponsorship block, content - the text near the image (also link, wrapped in href). Where ever you place sponsorship block, it will be concatenated and parsed at the top and bottom of email body.

Image or GIF

![src][href][alt text]

The first symbol !, and all other attributes are required, or error will appear. src - absolute path to image or may be url, href - the link of image, alt text - the text, when image not rendered yet.

Paragraph

Default paragraph contains no special opening symbols, just straight text.

Link

[content](href)

Consist of two parameters - content, the text of the link and href - the url of link. Can be placed at default paragraph.

Divider

You may use empty line in email body, just in the markdown document leave line empty, it will be parsed as real line break.

Separator

add [separator]

Work principles

The parser reads source file from source/source.md and based on opening tag renders goes in layouts folder and chooses relevant typography or section (sponsorship) element. Supported tags displayed in this document.

mindmap

Reasons to use generator instead of pretending that human errors didnt exists(especially human reactions on deadlines)

oops

ooops2

Links

  • https://codepen.io/rh/pen/BoyNdy
  • https://gist.github.com/renehamburger/12f14a9bd9297394e5bd
  • https://github.com/Chalarangelo/parse-md-js/blob/master/parsemd.js
  • https://www.bigomega.dev/markdown-parser
  • https://gist.github.com/budparr/112f08a3033dd878d0e271e2af61faef
  • https://gist.github.com/jbroadway/2836900
  • https://stackoverflow.com/questions/47016770/replace-markdown-characters-with-regex
  • https://www.htmlemailcheck.com/check/

install "pixel-email-cli" and try it https://github.com/LLazyEmail/pixel-email-cli

Markdown to email template generator

We tried to create our own wheel, then we failed. Arthur get bored trying to fix it and make it work properly. So he just decide to google a working version that can solve his problems.

Story: 0. I find this link https://gist.github.com/jbroadway/2836900

  1. then this link https://gist.github.com/budparr/112f08a3033dd878d0e271e2af61faef
  2. and then I added javascript into my google Search https://gist.github.com/renehamburger/12f14a9bd9297394e5bd
  3. then we tried different approaches, failed few times and find out how to fix some bugs.
  4. then I tried to google our repository and find out the latest version of this module - https://github.com/showdownjs/showdown
  5. then I find out that all template engines still sucks and decide to migrate "frontend" part to react
  6. i'm exploring the best known to me tools for markdown: remark and rehype. plus, as docusaurus using them and mdx format - we'll try it too

Arthur Tkachenko articles