Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Nov 5, 2015
0 parents commit eee5639
Show file tree
Hide file tree
Showing 9 changed files with 482 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_size = 2
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
54 changes: 54 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
###Node###

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# Users Environment Variables
.lock-wscript


###OSX###

.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
Expand Down
62 changes: 62 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
###Node###

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# Users Environment Variables
.lock-wscript


###OSX###

.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# npm specific

test
.cz.json
.travis.yml
.editorconfig
36 changes: 36 additions & 0 deletions examples/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';

/**
* html-to-markdown
* Copyright(c) 2015-2015 Harminder Virk
* MIT Licensed
*/

var converter = require('../index');

var html = `<div>
<h2> This is a dummy heading for Lorem guy </h2>
<h3> I am sub heading buddy </h3>
<p> This is a paragrap buddy </p>
<ul>
<li> This is ul 1 </li>
</ul>
<ol>
<li> This is ol 1 </li>
</ol>
<ul>
<li> This is ul 2 </li>
</ul>
<section> This is a section </section>
<pre>
var name = "foo";
</pre>
<blockquote>
This is super quote
In multiple lines
</blockquote>
<b> This is bold tag </b>
<i> Some italic </i>
</div>
`
console.log(converter.convert(html))
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

/**
* html-to-markdown
* Copyright(c) 2015-2015 Harminder Virk
* MIT Licensed
*/

module.exports = require('./src/index.js');
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "html-to-markdown",
"version": "1.0.0",
"description": "html to markdown converter with zero dependencies",
"main": "index.js",
"directories": {
"example": "examples"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"html-to-markdown",
"markdown"
],
"author": "amanvirk",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/thetutlage/html-to-markdown.git"
},
"bugs": {
"url": "https://github.com/thetutlage/html-to-markdown/issues"
},
"homepage": "https://github.com/thetutlage/html-to-markdown#readme"
}
35 changes: 35 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Html to markdown converter

Html to markdown converter is a dependency free converter which replaces html with a valid markdown syntax. I have just started working on it, so all tags may not be supported.

## Supported Platforms

1. Web browsers.
2. NodeJs

## Tags Supported

1. h1,h2,h3,h4,h5,h6
2. p
3. ul,ol
4. blockquote,
5. pre
6. bold,strong
7. italic,em

## Converting Html Documents

```javascript
var converter = require('html-to-markdown');
var markdown = converter.convert('<h2> Happy Journey </h2>');
```

## Extending to add your own formatters.

```javascript
var converter = require('html-to-markdown');
converter.use(function (html) {
// making required changes
// and return new html
})
```
Loading

0 comments on commit eee5639

Please sign in to comment.