Installation
Quick Take
Idea
ESP template tags (anything, from Mailchimp to Salesforce) or templating languages (like Nunjucks), when previewed in browser, appear at wrong places. It's because templating tags are often placed between table
, tr
or td
tags.
This program patches table structures, so you can visually check them easier:

API - patcher()
The main function patcher()
is imported like this:
It's a function which takes two input arguments:
Input argument | Key value's type | Obligatory? | Description |
---|---|---|---|
str | String | yes | HTML source code. |
opts | Plain object | no | An Optional Options Object. |
The optional options object has the following shape:
Options Object's key | Value's type | Default value | Description |
---|---|---|---|
cssStylesContent | string | "" (empty string) | Whatever you put here, will end up on every newly-added TD's inline style tag's value |
alwaysCenter | boolean | false | Every newly-added TD should have its contents centered (via an inline align="center" HTML attribute) |
Here are all defaults in one place for copying:
Function returns a plain object:
Key's name | Key value's type | Description |
---|---|---|
result | String | Result string containing patched code |
API - defaults
You can import defaults
:
It's a plain object:
The main function calculates the options to be used by merging the options you passed with these defaults.
API - version
You can import version
:
The algorithm
We parse using codsen-parser
then traverse using ast-monkey-traverse-with-lookahead
and record what needs to be amended using ranges-push
and finally, apply all changes in one go using ranges-apply
.