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 element modifiers for picture and images #370

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ Here's a complete list of available element modifiers:
| `prose-th:{utility}` | `th` |
| `prose-td:{utility}` | `td` |
| `prose-img:{utility}` | `img` |
| `prose-picture:{utility}` | `picture` |
| `prose-images:{utility}` | `img`, `picture > img` |
| `prose-video:{utility}` | `video` |
| `prose-hr:{utility}` | `hr` |

Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ module.exports = plugin.withOptions(
['th'],
['td'],
['img'],
['picture'],
['img', 'picture > img'],
['video'],
['hr'],
['lead', '[class~="lead"]'],
Expand Down
20 changes: 20 additions & 0 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,8 @@ test('element variants', async () => {
prose-th:text-left
prose-td:align-center
prose-img:rounded-lg
prose-picture:rounded-lg
prose-images:rounded-lg
prose-video:my-12
prose-hr:border-t-2
"
Expand Down Expand Up @@ -855,6 +857,14 @@ test('element variants', async () => {
:is(:where(img):not(:where([class~='not-prose'], [class~='not-prose'] *))) {
border-radius: 0.5rem;
}
.prose-picture\:rounded-lg
:is(:where(picture):not(:where([class~='not-prose'], [class~='not-prose'] *))) {
border-radius: 0.5rem;
}
.prose-images\:rounded-lg
:is(:where(img, picture > img):not(:where([class~='not-prose'], [class~='not-prose'] *))) {
border-radius: 0.5rem;
}
.prose-video\:my-12
:is(:where(video):not(:where([class~='not-prose'], [class~='not-prose'] *))) {
margin-top: 3rem;
Expand Down Expand Up @@ -906,6 +916,8 @@ test('element variants with custom class name', async () => {
markdown-th:text-left
markdown-td:align-center
markdown-img:rounded-lg
markdown-picture:rounded-lg
markdown-images:rounded-lg
markdown-video:my-12
markdown-hr:border-t-2
"
Expand Down Expand Up @@ -1059,6 +1071,14 @@ test('element variants with custom class name', async () => {
:is(:where(img):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) {
border-radius: 0.5rem;
}
.markdown-picture\:rounded-lg
:is(:where(picture):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) {
border-radius: 0.5rem;
}
.markdown-images\:rounded-lg
:is(:where(img, picture > img):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) {
border-radius: 0.5rem;
}
.markdown-video\:my-12
:is(:where(video):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) {
margin-top: 3rem;
Expand Down