-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Raine Revere <raine@cybersemics.org>
- Loading branch information
1 parent
e8fa57c
commit db59f8b
Showing
9 changed files
with
816 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { isMarkdown } from '../isMarkdown' | ||
|
||
describe('isMarkdown', () => { | ||
it('should identify markdown with headings', () => { | ||
const markdown = ` | ||
plain text before heading | ||
# Heading 1 | ||
` | ||
expect(isMarkdown(markdown)).toBe(true) | ||
}) | ||
|
||
it('should identify markdown with links', () => { | ||
const markdown = ` | ||
This is a [link](https://example.com) | ||
` | ||
expect(isMarkdown(markdown)).toBe(true) | ||
}) | ||
|
||
it('should identify markdown with images', () => { | ||
const markdown = ` | ||
- List item 1 | ||
- List item 2 | ||
- List item 3 | ||
![Alt text](https://example.com/image.jpg) | ||
` | ||
expect(isMarkdown(markdown)).toBe(true) | ||
}) | ||
|
||
it('should not identify plain text as markdown', () => { | ||
const plainText = ` | ||
This is just plain text. | ||
It has no markdown elements. | ||
` | ||
expect(isMarkdown(plainText)).toBe(false) | ||
}) | ||
|
||
it('should not identify HTML as markdown', () => { | ||
const html = ` | ||
<h1>This is HTML</h1> | ||
<p>This is a paragraph with a <a href="https://example.com">link</a>.</p> | ||
<img src="https://example.com/image.jpg" alt="Image"> | ||
` | ||
expect(isMarkdown(html)).toBe(false) | ||
}) | ||
}) |
Oops, something went wrong.