ruff/crates/ruff_python_formatter/tests/snapshots
Andrew Gallant 04ec11a73d
ruff_python_formatter: support reformatting Markdown code blocks (#9030)
(This is not possible to actually use until
https://github.com/astral-sh/ruff/pull/8854 is merged.)

This commit slots in support for formatting Markdown fenced code
blocks[1]. With the refactoring done for reStructuredText previously,
this ended up being pretty easy to add. Markdown code blocks are also
quite a bit easier to parse and recognize correctly.

One point of contention in #8860 is whether to assume that unlabeled
Markdown code fences are Python or not by default. In this PR, we make
such an assumption. This follows what `rustdoc` does. The mitigation
here is that if an unlabeled code block isn't Python, then it probably
won't parse as Python. And we'll end up skipping it. So in the vast
majority of cases, the worst thing that can happen is a little bit of
wasted work.

Closes #8860

[1]: https://spec.commonmark.org/0.30/#fenced-code-blocks
2023-12-07 14:30:43 -05:00
..
black_compatibility@cases__comment_after_escaped_newline.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__comments2.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__comments6.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__comments9.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__comments_in_blocks.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__composition.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__composition_no_trailing_comma.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__conditional_expression.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__docstring_no_string_normalization.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__expression.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__fmtonoff.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__fmtonoff4.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__fmtonoff5.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__fmtpass_imports.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__fmtskip5.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__funcdef_return_type_trailing_comma.py.snap Insert trailing comma when function breaks with single argument (#8921) 2023-11-30 21:49:28 -05:00
black_compatibility@cases__function.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__function2.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__ignore_pyi.pyi.snap Enforce valid format options in spec tests (#9021) 2023-12-06 07:15:06 +00:00
black_compatibility@cases__line_ranges_basic.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__line_ranges_diff_edge_case.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__line_ranges_fmt_off.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__line_ranges_fmt_off_decorator.py.snap Enforce valid format options in spec tests (#9021) 2023-12-06 07:15:06 +00:00
black_compatibility@cases__line_ranges_fmt_off_overlap.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__line_ranges_indentation.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__line_ranges_two_passes.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__line_ranges_unwrapping.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__long_strings_flag_disabled.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__multiline_consecutive_open_parentheses_ignore.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__nested_stub.pyi.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__pattern_matching_style.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__pep604_union_types_line_breaks.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__pep_572_py310.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__pep_572_remove_parens.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__power_op_newline.py.snap Enforce valid format options in spec tests (#9021) 2023-12-06 07:15:06 +00:00
black_compatibility@cases__preview_allow_empty_first_line_in_special_cases.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_cantfit.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_comments7.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_context_managers_39.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_context_managers_autodetect_39.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_context_managers_autodetect_310.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_context_managers_autodetect_311.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_docstring_no_string_normalization.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_dummy_implementations.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_form_feeds.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_format_unicode_escape_seq.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_hug_parens_with_braces_and_square_brackets.py.snap Update formatter fixtures (#8935) 2023-12-01 02:57:05 +00:00
black_compatibility@cases__preview_long_dict_values.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_long_strings.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_long_strings__east_asian_width.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_long_strings__edge_case.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_long_strings__regression.py.snap Update formatter fixtures (#8935) 2023-12-01 02:57:05 +00:00
black_compatibility@cases__preview_long_strings__type_annotations.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_multiline_strings.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_no_blank_line_before_docstring.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_pattern_matching_trailing_comma.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_pep_572.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_percent_precedence.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_prefer_rhs_split.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__preview_return_annotation_brackets_string.py.snap Insert trailing comma when function breaks with single argument (#8921) 2023-11-30 21:49:28 -05:00
black_compatibility@cases__preview_single_line_format_skip_with_multiple_comments.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__raw_docstring.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__remove_await_parens.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__remove_except_parens.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__remove_for_brackets.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__return_annotation_brackets.py.snap Insert trailing comma when function breaks with single argument (#8921) 2023-11-30 21:49:28 -05:00
black_compatibility@cases__stub.pyi.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__torture.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__trailing_commas_in_leading_parts.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@cases__tupleassign.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@conditional_expression.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
black_compatibility@miscellaneous__blackd_diff.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
black_compatibility@miscellaneous__debug_visitor.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
black_compatibility@miscellaneous__force_pyi.py.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@miscellaneous__force_pyi.pyi.snap Update Black tests (#8901) 2023-11-30 00:09:55 +00:00
black_compatibility@miscellaneous__string_quotes.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
black_compatibility@raw_docstring.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
black_compatibility@simple_cases__preview_hug_parens_with_braces_and_square_brackets.py.snap Implement multiline dictionary and list hugging for preview style (#8293) 2023-11-30 21:11:14 -05:00
format@carriage_return__string.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@docstring.py.snap Use double quotes for all docstrings, including single-quoted docstrings (#9020) 2023-12-07 04:41:00 +00:00
format@docstring_code_examples.py.snap ruff_python_formatter: support reformatting Markdown code blocks (#9030) 2023-12-07 14:30:43 -05:00
format@docstring_code_examples_crlf.py.snap format doctests in docstrings (#8811) 2023-11-27 11:14:55 -05:00
format@empty_multiple_trailing_newlines.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@empty_now_newline.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@empty_trailing_newline.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@empty_whitespace.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__annotated_assign.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__attribute.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__await.py.snap Fix instability with await fluent style (#8676) 2023-11-17 12:24:19 -05:00
format@expression__binary.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__binary_implicit_string.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__binary_pow_spacing.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__boolean_operation.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__bytes.py.snap format doctests in docstrings (#8811) 2023-11-27 11:14:55 -05:00
format@expression__call.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__compare.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__dict.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__dict_comp.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__fstring.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__generator_exp.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__hug.py.snap Implement multiline dictionary and list hugging for preview style (#8293) 2023-11-30 21:11:14 -05:00
format@expression__if.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__lambda.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__list.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__list_comp.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__named_expr.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__number.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__optional_parentheses_comments.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__set_comp.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__slice.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__split_empty_brackets.py.snap Implement multiline dictionary and list hugging for preview style (#8293) 2023-11-30 21:11:14 -05:00
format@expression__starred.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__string.py.snap format doctests in docstrings (#8811) 2023-11-27 11:14:55 -05:00
format@expression__subscript.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__tuple.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__unary.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__unsplittable.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__yield.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@expression__yield_from.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__comments.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__empty_file.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__fmt_off_docstring.py.snap format doctests in docstrings (#8811) 2023-11-27 11:14:55 -05:00
format@fmt_on_off__fmt_off_unclosed_deep_nested_trailing_comment.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__fmt_off_unclosed_trailing_comment.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__form_feed.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__indent.py.snap format doctests in docstrings (#8811) 2023-11-27 11:14:55 -05:00
format@fmt_on_off__last_statement.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__mixed_space_and_tab.py.snap format doctests in docstrings (#8811) 2023-11-27 11:14:55 -05:00
format@fmt_on_off__newlines.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__no_fmt_on.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__off_on_off_on.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__simple.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__trailing_comments.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__trailing_semicolon.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_on_off__yapf.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_skip__decorators.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_skip__docstrings.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_skip__match.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_skip__or_else.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_skip__parentheses.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_skip__trailing_semi.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@fmt_skip__type_params.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@form_feed.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@module_dangling_comment1.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@module_dangling_comment2.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@newlines.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@newlines.pyi.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@parentheses__call_chains.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@parentheses__expression_parentheses_comments.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@parentheses__nested.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@parentheses__opening_parentheses_comment_empty.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@parentheses__opening_parentheses_comment_value.py.snap Insert trailing comma when function breaks with single argument (#8921) 2023-11-30 21:49:28 -05:00
format@preview.py.snap format doctests in docstrings (#8811) 2023-11-27 11:14:55 -05:00
format@skip_magic_trailing_comma.py.snap format doctests in docstrings (#8811) 2023-11-27 11:14:55 -05:00
format@statement__ann_assign.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__assert.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__assign.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__aug_assign.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__break.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__class_definition.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__delete.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__ellipsis.pyi.snap Avoid unstable formatting in ellipsis-only body with trailing comment (#8984) 2023-12-03 19:15:40 -05:00
format@statement__for.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__function.py.snap Insert trailing comma when function breaks with single argument (#8921) 2023-11-30 21:49:28 -05:00
format@statement__global.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__if.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__import.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__import_from.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__match.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__module_comment.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__nonlocal.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__raise.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__return.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__return_annotation.py.snap Insert trailing comma when function breaks with single argument (#8921) 2023-11-30 21:49:28 -05:00
format@statement__top_level.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__top_level.pyi.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__try.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__type_alias.py.snap Inline trailing comments for type alias similar to assignments (#8941) 2023-12-04 05:27:04 +00:00
format@statement__while.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@statement__with.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@stub_files__comments.pyi.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@stub_files__nesting.pyi.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@stub_files__suite.pyi.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@stub_files__top_level.pyi.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@tab_width.py.snap format doctests in docstrings (#8811) 2023-11-27 11:14:55 -05:00
format@trailing_comments.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00
format@trivia.py.snap Apply consistent code block labels (#8563) 2023-11-09 01:49:24 +00:00