-
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.
fix(deps)!: update unified ecosystem dependencies
- Loading branch information
Showing
16 changed files
with
1,791 additions
and
1,360 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
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 |
---|---|---|
@@ -1,13 +1,33 @@ | ||
import { isTextNode } from './unified' | ||
import { isHastElement, isHastTextNode } from './unified' | ||
|
||
describe('Helper: Unified', () => { | ||
describe('#isTextNode', () => { | ||
describe('#isHastElement', () => { | ||
test('returns `true` when the given node is an element with the specified tag name', () => { | ||
expect( | ||
// @ts-expect-error Simplified node for testing purposes | ||
isHastElement({ type: 'element', tagName: 'div' }, 'div'), | ||
).toBe(true) | ||
}) | ||
|
||
test('returns `false` when the given node is NOT an element with the specified tag name', () => { | ||
expect( | ||
// @ts-expect-error Simplified node for testing purposes | ||
isHastElement({ type: 'element', tagName: 'span' }, 'div'), | ||
).toBe(false) | ||
}) | ||
|
||
test('returns `false` when the given node is NOT an element', () => { | ||
expect(isHastElement({ type: 'text' }, 'div')).toBe(false) | ||
}) | ||
}) | ||
|
||
describe('#isHastTextNode', () => { | ||
test('returns `true` when the given node is a hast text node', () => { | ||
expect(isTextNode({ type: 'text' })).toBe(true) | ||
expect(isHastTextNode({ type: 'text' })).toBe(true) | ||
}) | ||
|
||
test('returns `false` when the given node is NOT a hast text node', () => { | ||
expect(isTextNode({ type: 'element' })).toBe(false) | ||
expect(isHastTextNode({ 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 |
---|---|---|
@@ -1,16 +1,29 @@ | ||
import { is } from 'unist-util-is' | ||
|
||
import type { Node, Text } from 'hast' | ||
import type { Element, Text } from 'hast' | ||
import type { Node } from 'unist' | ||
|
||
/** | ||
* Check if a given node is a unist text node. | ||
* Determines whether a given node is an hast element with a specific tag name. | ||
* | ||
* @param node The node to check. | ||
* @param tagName The tag name to check for. | ||
* | ||
* @returns `true` if the node is a unist text node, `false` otherwise. | ||
* @returns `true` if the node is an hast element with the specified tag name, `false` otherwise. | ||
*/ | ||
function isTextNode(node: Node): node is Text { | ||
function isHastElement(node: Node, tagName: Element['tagName']): node is Element { | ||
return is(node, { type: 'element', tagName }) | ||
} | ||
|
||
/** | ||
* Determines whether a given node is hast a text node. | ||
* | ||
* @param node The node to check. | ||
* | ||
* @returns `true` if the node is a hast text node, `false` otherwise. | ||
*/ | ||
function isHastTextNode(node: Node): node is Text { | ||
return is(node, { type: 'text' }) | ||
} | ||
|
||
export { isTextNode } | ||
export { isHastElement, isHastTextNode } |
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
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,8 @@ | ||
import type { Options as Extension } from 'mdast-util-to-markdown' | ||
|
||
// https://github.com/remarkjs/remark/blob/5017a27db024db6feec85a3e1e19f8d78a485680/packages/remark-stringify/index.d.ts#L26-L41 | ||
declare module 'unified' { | ||
interface Data { | ||
toMarkdownExtensions?: Extension[] | ||
} | ||
} |
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