mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2025-09-14 00:34:10 +07:00
Add markdown format support (#25)
Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
This commit is contained in:
78
node_modules/showdown/test/node/showdown.Converter.makeHtml.js
generated
vendored
Normal file
78
node_modules/showdown/test/node/showdown.Converter.makeHtml.js
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Created by Estevao on 15-01-2015.
|
||||
*/
|
||||
|
||||
describe('showdown.Converter', function () {
|
||||
'use strict';
|
||||
|
||||
require('source-map-support').install();
|
||||
require('chai').should();
|
||||
|
||||
var showdown = require('../bootstrap').showdown;
|
||||
|
||||
describe('makeHtml() with option omitExtraWLInCodeBlocks', function () {
|
||||
var converter = new showdown.Converter({omitExtraWLInCodeBlocks: true}),
|
||||
text = 'var foo = bar;',
|
||||
html = converter.makeHtml(' ' + text);
|
||||
it('should omit extra line after code tag', function () {
|
||||
var expectedHtml = '<pre><code>' + text + '</code></pre>';
|
||||
html.should.equal(expectedHtml);
|
||||
});
|
||||
});
|
||||
|
||||
describe('makeHtml() with option prefixHeaderId', function () {
|
||||
var converter = new showdown.Converter(),
|
||||
text = 'foo header';
|
||||
|
||||
it('should prefix header id with "section"', function () {
|
||||
converter.setOption('prefixHeaderId', true);
|
||||
var html = converter.makeHtml('# ' + text),
|
||||
expectedHtml = '<h1 id="sectionfooheader">' + text + '</h1>';
|
||||
html.should.equal(expectedHtml);
|
||||
});
|
||||
|
||||
it('should prefix header id with custom string', function () {
|
||||
converter.setOption('prefixHeaderId', 'blabla');
|
||||
var html = converter.makeHtml('# ' + text),
|
||||
expectedHtml = '<h1 id="blablafooheader">' + text + '</h1>';
|
||||
html.should.equal(expectedHtml);
|
||||
});
|
||||
});
|
||||
|
||||
describe('makeHtml() with option metadata', function () {
|
||||
var converter = new showdown.Converter(),
|
||||
text1 =
|
||||
'---SIMPLE\n' +
|
||||
'foo: bar\n' +
|
||||
'baz: bazinga\n' +
|
||||
'---\n',
|
||||
text2 =
|
||||
'---TIVIE\n' +
|
||||
'a: b\n' +
|
||||
'c: 123\n' +
|
||||
'---\n';
|
||||
|
||||
it('should correctly set metadata', function () {
|
||||
converter.setOption('metadata', true);
|
||||
|
||||
var expectedHtml = '',
|
||||
expectedObj = {foo: 'bar', baz: 'bazinga'},
|
||||
expectedRaw = 'foo: bar\nbaz: bazinga',
|
||||
expectedFormat = 'SIMPLE';
|
||||
converter.makeHtml(text1).should.equal(expectedHtml);
|
||||
converter.getMetadata().should.eql(expectedObj);
|
||||
converter.getMetadata(true).should.equal(expectedRaw);
|
||||
converter.getMetadataFormat().should.equal(expectedFormat);
|
||||
});
|
||||
|
||||
it('consecutive calls should reset metadata', function () {
|
||||
converter.makeHtml(text2);
|
||||
var expectedObj = {a: 'b', c: '123'},
|
||||
expectedRaw = 'a: b\nc: 123',
|
||||
expectedFormat = 'TIVIE';
|
||||
converter.getMetadata().should.eql(expectedObj);
|
||||
converter.getMetadata(true).should.equal(expectedRaw);
|
||||
converter.getMetadataFormat().should.equal(expectedFormat);
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user