-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Replace HTML serializer with the
unified
ecosystem
- Loading branch information
Showing
19 changed files
with
1,026 additions
and
803 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,13 @@ | ||
import { isTextNode } from './unified' | ||
|
||
describe('Helper: Unified', () => { | ||
describe('#isTextNode', () => { | ||
test('returns `true` when the given node is a hast text node', () => { | ||
expect(isTextNode({ type: 'text' })).toBe(true) | ||
}) | ||
|
||
test('returns `false` when the given node is NOT a hast text node', () => { | ||
expect(isTextNode({ type: 'element' })).toBe(false) | ||
}) | ||
}) | ||
}) |
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,16 @@ | ||
import { is } from 'unist-util-is' | ||
|
||
import type { Node, Text } from 'hast' | ||
|
||
/** | ||
* Check if a given node is a unist text node. | ||
* | ||
* @param node The node to check. | ||
* | ||
* @returns `true` if the node is a unist text node, `false` otherwise. | ||
*/ | ||
function isTextNode(node: Node): node is Text { | ||
return is(node, { type: 'text' }) | ||
} | ||
|
||
export { isTextNode } |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.