-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Apply formatting to markdown code blocks #22470
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
Merged
+664
−149
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
df5c04b
Create new source types for markdown files
amyreese 296d101
Update source kind from path mapping
amyreese dc50d77
Minimal prototype using regex
amyreese b6ab7fe
Map pyi code block to pyi source type
amyreese cd94b2d
Skip linting .md files for now
amyreese d23610c
Use static lazy lock for markdown regex
amyreese 9ea195a
Gate formatting markdown on preview mode
amyreese 1521834
todos for markdown code block regex/parsing
amyreese 0e787cb
Add markdown test fixture
amyreese a2c7b4f
Simple CLI tests
amyreese 04d6636
Fix markdown formatting on stdin, add stdin test
amyreese 79b23a9
test with relative paths
amyreese 64bfbba
Skip walking markdown files in ty
amyreese f130cdc
Refactor source type/kind usage
amyreese c019e1f
Return better error types for unsupported range formatting and markdown
amyreese 4c5d430
Use Self
amyreese 68b5f95
Updated snapshots
amyreese c456eed
Add fixture path helper and default CRATE_ROOT filter
amyreese a417da8
Move markdown bits into new ruff_markdown crate
amyreese 6be5947
Add some tests, fix clippy
amyreese 2c61937
Better wording for 'experimental' message
amyreese bdd7047
Shortened fixture test cases
amyreese 1b69970
Fix cargo files
amyreese 341cfb3
Drop source kind toml
amyreese 364325d
Include PySourceType in SourceKind::Python
amyreese 8ec6ccc
Update error messages
amyreese 7173d78
Update fixture and snapshots
amyreese def3641
Remove trivia dep
amyreese 47f252d
snapshots
amyreese a3a2c56
Loop over captures and use range replacement instead of replace_all
amyreese 2ba6eb5
Support unlabeled blocks, more tests
amyreese 48fc2f5
Only wrap a bool type for source kind python
amyreese cde3adb
Update fuzz test
amyreese a61ab53
Get code range straight from regex
amyreese 80911e2
clippy
amyreese 7074b1a
static lifetime
amyreese cb1e001
Call it PreviewFeature
amyreese 56e9eb9
explicit match arms
amyreese 6f340cd
zero ver
amyreese d5f0a30
Build formatted string iteratively
amyreese 3fd00de
Docs update
amyreese ce978f8
Refactor match arms
amyreese 2060a2b
use nested match statements
amyreese d143fb1
Make SourceKind::Python a struct rather than tuple
amyreese 0e5bbd3
Fuzz
amyreese File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,11 @@ | ||
| This is a markdown document with two fenced code blocks: | ||
|
|
||
| ```py | ||
| print( "hello" ) | ||
| def foo(): pass | ||
| ``` | ||
|
|
||
| ```pyi | ||
| print( "hello" ) | ||
| def foo(): pass | ||
| ``` |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.