tutotentia-formatter
v1.0.0
Published
A custom formatter for Markdown written articles following Autentia's rules
Downloads
1
Readme
tutotentia-formatter
- Add target="_blank" to all external links
- Generate a table of contents given titles
- Generate the code snippets using the appropiate convention styles
- Add
<!--more-->
tag after first paragraph
Usage
import Formatter from 'tutotentia-formatter';
const document = `
Introduction
# Title 1
some text
# Título 2
some other text
## Subtitle 1
some subtitle text
`;
const formatter = new Formatter(document);
formatter.parsedDocument;
/*
<p>Introduction</p>
<!--more-->
<ul>
<li><a href=\"#title-1\">Title 1</a></li>
<li><a href=\"#titulo-2\">Título 2</a><ul>
<li><a href=\"#subtitle-1\">Subtitle 1</a></li>
</ul>
</li>
</ul>
<h1 id=\"title-1\">Title 1</h1>
<p>some text</p>
<h1 id=\"t-tulo-2\">Título 2</h1>
<p>some other text</p>
<h2 id="subtitle-1">Subtitle 1</h2>
<p>some subtitle text</p>
*/
## Developing
Start Typescript:
yarn tsc -- --watch --pretty
Run module:
yarn start
Run the tests:
yarn test -- --watchAll