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 support for on/off comments #287

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

pawamoy
Copy link

@pawamoy pawamoy commented Sep 16, 2023

Closes #193

@pawamoy
Copy link
Author

pawamoy commented Sep 16, 2023

Not sure yet how you'd like to add support for rST and Latex.

rST comments would look like this:

..
    blacken-docs:off

.. code-block:: python

    f(1,2,3)

..
    blacken-docs:on

And Latex ones like this:

% blacken-docs:off

\begin{minted}{python}
f(1,2,3)
\end{minted}

% blacken-docs:on

Should we extend the comment regex to match all three kinds of comments regardless of the source file type?

@pawamoy
Copy link
Author

pawamoy commented Sep 18, 2023

OK we now have a single regex for the three syntax, and tests for each.

@pawamoy pawamoy marked this pull request as ready for review September 18, 2023 10:59
@pawamoy
Copy link
Author

pawamoy commented Sep 18, 2023

Pre-commit doesn't use the modified code, therefore my examples in the README got formatted 😅
I suppose we should first release, then modify back to remove spaces in f(1, 2, 3), and this time it won't get formatted.

@pawamoy
Copy link
Author

pawamoy commented Sep 18, 2023

Also note sure how to cover line 120.

@pawamoy
Copy link
Author

pawamoy commented Sep 25, 2023

@adamchainz gentle ping 🙂

@pawamoy
Copy link
Author

pawamoy commented Oct 6, 2023

@adamchainz is it OK if I ping you from time to time? That's what I ask from others when I don't answer, but you might work differently, and I don't want to bother you 🙂

@adamchainz
Copy link
Owner

Please don’t ping

pawamoy added a commit to pawamoy/copier-pdm that referenced this pull request Oct 12, 2023
@pawamoy
Copy link
Author

pawamoy commented Mar 5, 2024

I stopped using blacken-docs some time ago, so I'll close this PR, but feel free to reopen it if you or other users are still interested in getting it merged 🙂

@pawamoy pawamoy closed this Mar 5, 2024
@adamchainz
Copy link
Owner

I still intend to add this

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.

Add possibilities to skip blocks and lines?
2 participants