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

Incompatible with prettier. #29

Open
proofit404 opened this issue Nov 9, 2020 · 1 comment
Open

Incompatible with prettier. #29

proofit404 opened this issue Nov 9, 2020 · 1 comment

Comments

@proofit404
Copy link

Hello, thanks for wonderful tool!

Prettier is a very popular pretty printer tool. It could be used to format javascript, yaml, markdown, and a lot more file formats.

Unfortunately, it has compatibility issues with syntax proposed by this extension.

If I run prettier --write . command it will change my document like this:

diff --git a/docs/reference.md b/docs/reference.md
index 3143ee2..fa4022d 100644
@@ -1,13 +1,10 @@
 # Reference

 ::: generics.private
-    :docstring:
+:docstring:

 ::: generics.delegated
-    :docstring:
+:docstring:

 ::: generics.defended
-    :docstring:
+:docstring:

 <p align="center">&mdash; ⭐ &mdash;</p>
 <p align="center"><i>The generics library is part of the SOLID python family.</i></p>

I I run prettier --prose-wrap=always --write . commant it will change my document like this:

diff --git a/docs/reference.md b/docs/reference.md
index 3143ee2..fa4022d 100644
@@ -1,13 +1,10 @@
 # Reference

-::: generics.private
-    :docstring:
+::: generics.private :docstring:

-::: generics.delegated
-    :docstring:
+::: generics.delegated :docstring:

-::: generics.defended
-    :docstring:
+::: generics.defended :docstring:

 <p align="center">&mdash; ⭐ &mdash;</p>
 <p align="center"><i>The generics library is part of the SOLID python family.</i></p>

None of these variants is compatible with the auto doc extension provided by this package.

Similar extensions like admonitions works fine with prettier. For example, you can use in this way:

!!! note

    Subtyping inheritance with `abc.Meta` is not implemented yet.  We have plans to implement it in the future.

The result will look like this. Scroll up a little bit to see a note

Is there any way to make it work with prettier? If no, could you explain how could I could extend the project to achieve it? Happy to make a small pull request to make this happen.

Have a good day 🌴

Best regards,
Artem.

@chrislawlor
Copy link

chrislawlor commented Dec 22, 2022

As a workaround, prepend your blocks with <!-- prettier-ignore -->, like this:

<!-- prettier-ignore -->
::: generics.private
    :docstring:

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

No branches or pull requests

2 participants