Skip to content

Commit

Permalink
Fix markdown hyperlink (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lexedia authored Oct 18, 2023
1 parent 3fdee4b commit e224e3b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/src/utils/formatters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ String quoteBlock(String content) => '>>> $content';
String hideEmbed(String url) => '<$url>';

/// Format the [content] and the URL into a hyperlink (aka [Markdown link](https://www.markdownguide.org/basic-syntax/#links)), and optionally, add a [title] that will be displayed on hover.
String hyperlink(String content, String url, [String? title]) => '[$content](<$url${title != null ? ' "$title"' : ''}>)';
String hyperlink(String content, String url, [String? title]) => '[$content](<$url>${title != null ? ' "$title"' : ''})';

/// Wraps the [content] inside `||`.
String spoiler(String content) => '||$content||';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/formatters_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ $testContent
'Hyperlink',
() => expect(
hyperlink(testContent, 'https://example.com', 'Example'),
equals('[$testContent](<https://example.com "Example">)'),
equals('[$testContent](<https://example.com> "Example")'),
),
);

Expand Down

0 comments on commit e224e3b

Please sign in to comment.