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
.
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
.
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/
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:
#!
The subject of email, will be displayed in the email preview.
#~
Preview text of email, will be displayed in the email preview.
#
Title of email, by default at the top of email body.
##
Subtitle, can be seen anywhere in email body.
~[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.
![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.
Default paragraph contains no special opening symbols, just straight text.
[content](href)
Consist of two parameters - content
, the text of the link and href
- the url of link. Can be placed at default paragraph.
You may use empty line in email body, just in the markdown document leave line empty, it will be parsed as real line break.
add [separator]
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.
Links
install "pixel-email-cli" and try it https://github.com/LLazyEmail/pixel-email-cli
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: