Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options to disable default syntaxes #404

Merged
merged 3 commits into from
Apr 1, 2022
Merged

Add options to disable default syntaxes #404

merged 3 commits into from
Apr 1, 2022

Conversation

chenzhiguang
Copy link
Contributor

Fixes: #393

Example

const text = '<center><a>**some text**</a></center>';

final result = markdownToHtml(
  text,
  withDefaultInlineSyntaxes: false,
  withDefaultBlockSyntaxes: false,
  encodeHtml: false,
  inlineSyntaxes: [
    TagSyntax(r'\*+', requiresDelimiterRun: true),
  ],
);

print(result);

lib/src/block_parser.dart Outdated Show resolved Hide resolved
lib/src/document.dart Outdated Show resolved Hide resolved
lib/src/document.dart Outdated Show resolved Hide resolved
lib/src/document.dart Outdated Show resolved Hide resolved
lib/src/document.dart Outdated Show resolved Hide resolved
lib/src/document.dart Outdated Show resolved Hide resolved
lib/src/document.dart Outdated Show resolved Hide resolved
lib/src/html_renderer.dart Outdated Show resolved Hide resolved
Copy link
Member

@srawlins srawlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! We need some tests. Maybe something simple that:

  • no syntaxes; what does that look like?
  • no inline syntaxes
  • no block syntaxes

Copy link
Member

@srawlins srawlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great tests, thanks!

group('markdownToHtml', () {
const text = '# Hello **Markdown<em>!</em>**\n***';

test('with no syntaxes', () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent

@srawlins srawlins merged commit ed59235 into dart-lang:master Apr 1, 2022
@chenzhiguang chenzhiguang deleted the Options-to-disable-default-syntaxes branch April 2, 2022 11:23
roubachof pushed a commit to roubachof/markdown that referenced this pull request Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The ability to disable standard block/inline syntaxes
2 participants