Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/parser/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function parseMrkdwn(
case 'link': {
return `<${element.href}|${element.tokens
.flatMap(child => parseMrkdwn(child as typeof element))
.join('')}> `;
.join('')}>`;
}

case 'em': {
Expand Down
2 changes: 1 addition & 1 deletion test/integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ a **b** _c_ **_d_ e**
'59953191-480px'
),
slack.section('> block quote *a*\n> block quote b'),
slack.section('<https://apple.com|link> '),
slack.section('<https://apple.com|link>'),
slack.section('• bullet _a_\n• bullet _b_'),
slack.section('1. number _a_\n2. number _b_'),
slack.section('• checkbox false\n• checkbox true'),
Expand Down
17 changes: 16 additions & 1 deletion test/parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,22 @@ describe('parser', () => {
const tokens = marked.lexer('**a ~b~** c[*d*](https://example.com)');
const actual = parseBlocks(tokens);

const expected = [slack.section('*a ~b~* c<https://example.com|_d_> ')];
const expected = [slack.section('*a ~b~* c<https://example.com|_d_>')];

expect(actual).toStrictEqual(expected);
});

it('should not add extra spaces around inline links', () => {
const tokens = marked.lexer(
'- test [abc1234](https://example.com/commit/abc1234) by @user ([DES-123](https://jira.example/DES-123)) ([#456](https://github.example/pull/456))'
);
const actual = parseBlocks(tokens);

const expected = [
slack.section(
'• test <https://example.com/commit/abc1234|abc1234> by @user (<https://jira.example/DES-123|DES-123>) (<https://github.example/pull/456|#456>)'
),
];

expect(actual).toStrictEqual(expected);
});
Expand Down