totally bold in paragraph
")).toBe( + "*totally bold in paragraph*\n" + ); + expect(slackify("*already slackified bold*")).toBe( + "*already slackified bold*" + ); + expect(slackify("*bold inside asterisks*")).toBe( + "*bold *inside* asterisks*" + ); + expect(slackify("*asterisks *inside* asterisks*")).toBe( + "*asterisks *inside* asterisks*" + ); + expect( + slackify("A sentence with bold text in between.
") + ).toBe("A sentence with *bold text* in between.\n"); + }); + + it("test bold text with headers", () => { + expect(slackify("'; + const expected = + '```\n{\n "name": "slackify-html",\n "version": "1.0.0",\n "description": "convert simple html to slack markdown",\n "main": "slackify-html.js",\n "scripts": {\n "test": "tap tests.js"\n }\n}\n```\n'; + const output = slackify(input); + expect(output).toBe(expected); + }); + + it("test code block text only", () => { + const input = + '{
"name": "slackify-html",
"version": "1.0.0",
"description": "convert simple html to slack markdown",
"main": "slackify-html.js",
"scripts": {
"test": "tap tests.js"
}
}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
';
+ const expected =
+ "```\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n```\n";
+ const output = slackify(input);
+ expect(output).toBe(expected);
+ });
+
+ it("test blockquote with line breaks/new lines", () => {
+ expect(
+ slackify("block quote with") + ).toBe(">block quote with \n>line\n>breaks\n\n"); + expect( + slackify( + "
line
breaks
block quote with embedded\n\n newlines" + ) + ).toBe(">block quote with embedded\n>\n> newlines\n\n"); + expect( + slackify( + "
block quote with trailing newlines\n\n" + ) + ).toBe(">block quote with trailing newlines\n>\n\n"); + }); + + it("test blockquote with paragraphs and line breaks/new lines", () => { + expect( + slackify("
") + ).toBe(">paragraph in blockquote\n\n"); + expect( + slackify( + "paragraph in blockquote
" + ) + ).toBe(">paragraph\n>with\n>line break blockquote\n\n"); + expect( + slackify( + "paragraph
with
line break blockquote
" + ) + ).toBe(">paragraph block quote with embedded\n>\n> newlines\n\n"); + expect( + slackify( + "paragraph block quote with embedded\n\n newlines
" + ) + ).toBe(">paragraph block quote with trailing newlines\n>\n>\n\n"); + }); + + it("test guru blockquote", () => { + expect( + slackify( + 'paragraph block quote with trailing newlines\n\n
block quote text' + ) + ).toBe(">block quote text\n\n"); + expect( + slackify( + '
block quote bold text' + ) + ).toBe(">block quote *bold* text\n\n"); + expect( + slackify( + '
block quote italic text' + ) + ).toBe(">block quote _italic_ text\n\n"); + expect( + slackify( + '
block quote underline text' + ) + ).toBe(">block quote underline text\n\n"); + expect( + slackify( + '
block quote' + ) + ).toBe(">block quote ~strikethrough~ text\n\n"); + expect( + slackify( + 'strikethroughtext
block quote highlight text' + ) + ).toBe(">block quote highlight text\n\n"); + expect( + slackify( + '
block quote color text' + ) + ).toBe(">block quote color text\n\n"); + expect( + slackify( + '
block quote link' + ) + ).toBe(">block quote
block quote file' + ) + ).toBe(">block quote file\n\n"); + expect( + slackify( + '
block quote guru code snippet
'
+ )
+ ).toBe(">`block quote guru code snippet`\n\n");
+ });
+
+ it("full example", () => {
+ const input = `We take the security of your data very seriously!
In order to instill the necessary confidence, we wanted to provide full transparency on why, who, where, when and how we protect your data.
Given the sensitive nature of your content and need to maintain your privacy being a priority for us, we wanted to share the practices and policies we have put into place.
Here's a test blockquote with bolded information
Remember this list
foo
bar
buz
and this list too..
abc
sub1
sub2
def
xyz
and this
blah
Column 1 | Column 2 | Column 3 |
Foo | Bar | Baz |
abc | def | ghi |
one | dwqtwo | three |
dwqdwq | dwqdwqdwq | dwqdwqdwqdwq |
1
2
3
4
1st level
2nd level
3rd level
4th level
3rd level back
2nd level back
2nd level back again
1st level back
codeblock
bold italicized hyperlink EVERYTHING
Collapsible Element with nested one
Below is nested
Summary
Content