showdown/test/node/showdown.Converter.makeMarkdown.js
Estevao Soares dos Santos e4b0e69724 feat(converter.makeMarkdown): add an HTML to MD converter
Showdown now supports a simple HTML to Markdown converter.

**Usage:**

```
var conv = new showdown.Converter();
var md = conv.makeMarkdown('<a href="/url">a link</a>');
```

Closes #388, #233
2018-11-10 02:39:38 +00:00

26 lines
671 B
JavaScript

/**
* Created by Estevao on 15-01-2015.
*/
describe('showdown.Converter', function () {
'use strict';
require('source-map-support').install();
require('chai').should();
var jsdom = require('jsdom');
var document = new jsdom.JSDOM('', {}).window.document; // jshint ignore:line
var showdown = require('../bootstrap').showdown;
describe('makeMarkdown()', function () {
var converter = new showdown.Converter();
it('should parse a simple html string', function () {
var html = '<a href="/somefoo.html">a link</a>\n';
var md = '[a link](</somefoo.html>)';
converter.makeMd(html, document).should.equal(md);
});
});
});