open-index/open-npm huggingface dataset:
npm package: @htoojs/convert
Description: Markdown to HTML 
Author: @htoojs
Latest version: 0.1.4
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Convert

## Markdown to HTML with Showdown 

Markdown to HTML converter with [Showdown](https://showdownjs.com/) and [Showdown Highlight ](https://github.com/Bloggify/showdown-highlight) for custom usage.

## Usage

***Reading Time***

```javascript
import {readTime} from '@htoojs/convert';
const readingTime = readTime(text)
// return {number} in seconds
```

***Format Date***

```javascript
import { formatDate} from '@htoojs/convert';
const formatedDate = formatDate(date, locale);
// return {string}
```

***Converter***

Get data of post

```javascript
import { converter } from '@htoojs/convert';
// Get Frontmatter
const frontmatter = converter('path_to_mdfile').getData;
// Get json format
const json = converter('path_to_mdfile').getJson;
// Get title of post
const post_title = converter('path_to_mdfile').postTitle;
// Get date of post , return {string}
const post_date = converter('path_to_mdfile').postDate;
// Get reading time of post , return {number} in seconds
const post_reading_time = converter('path_to_mdfile').readingTime;
```

Get HTML return 

```javascript
import { converter } from '@htoojs/convert';
/* Get blog post with HTML , return {post-title,post-date,reading time} and {converted-post-content}*/
const post_html = converter('path_to_mdfile').postHtml;
/* Get page with HTML , return {converted-page-content} */
const page_html = converter('path_to_mdfile').pageHtml;
```

`Post HTML `

```html
 <h1><!-- post_title --> </h1>
 <small> <!-- post_date -->  |  Reading Time: <!-- post_reading_time --> minutes</small>
 <div> <!-- converted-post-content --> </div>
```

`Page HTML `

```html
 <div> <!-- converted-post-content --> </div>
```