Skip to content

Commit 3223d89

Browse files
committed
Add element modifiers for picture and images
Fixes tailwindlabs#366 Add element modifiers `prose-picture:*` and `prose-images:*` to target `<picture>` and `<img> <picture>` respectively. * Modify `src/index.js` to include element modifiers for `prose-picture:*` and `prose-images:*`. * Update `README.md` to list `prose-picture:*` and `prose-images:*` as available element modifiers. * Add default styles for `prose-picture:*` and `prose-images:*` in `src/styles.js`. * Add tests for the new element modifiers `prose-picture:*` and `prose-images:*` in `src/index.test.js`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/tailwindlabs/tailwindcss-typography/issues/366?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent 39d20e1 commit 3223d89

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ Here's a complete list of available element modifiers:
180180
| `prose-th:{utility}` | `th` |
181181
| `prose-td:{utility}` | `td` |
182182
| `prose-img:{utility}` | `img` |
183+
| `prose-picture:{utility}` | `picture` |
184+
| `prose-images:{utility}` | `img`, `picture > img` |
183185
| `prose-video:{utility}` | `video` |
184186
| `prose-hr:{utility}` | `hr` |
185187

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ module.exports = plugin.withOptions(
102102
['th'],
103103
['td'],
104104
['img'],
105+
['picture'],
106+
['img', 'picture > img'],
105107
['video'],
106108
['hr'],
107109
['lead', '[class~="lead"]'],

src/index.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,8 @@ test('element variants', async () => {
707707
prose-th:text-left
708708
prose-td:align-center
709709
prose-img:rounded-lg
710+
prose-picture:rounded-lg
711+
prose-images:rounded-lg
710712
prose-video:my-12
711713
prose-hr:border-t-2
712714
"
@@ -855,6 +857,14 @@ test('element variants', async () => {
855857
:is(:where(img):not(:where([class~='not-prose'], [class~='not-prose'] *))) {
856858
border-radius: 0.5rem;
857859
}
860+
.prose-picture\:rounded-lg
861+
:is(:where(picture):not(:where([class~='not-prose'], [class~='not-prose'] *))) {
862+
border-radius: 0.5rem;
863+
}
864+
.prose-images\:rounded-lg
865+
:is(:where(img, picture > img):not(:where([class~='not-prose'], [class~='not-prose'] *))) {
866+
border-radius: 0.5rem;
867+
}
858868
.prose-video\:my-12
859869
:is(:where(video):not(:where([class~='not-prose'], [class~='not-prose'] *))) {
860870
margin-top: 3rem;
@@ -906,6 +916,8 @@ test('element variants with custom class name', async () => {
906916
markdown-th:text-left
907917
markdown-td:align-center
908918
markdown-img:rounded-lg
919+
markdown-picture:rounded-lg
920+
markdown-images:rounded-lg
909921
markdown-video:my-12
910922
markdown-hr:border-t-2
911923
"
@@ -1059,6 +1071,14 @@ test('element variants with custom class name', async () => {
10591071
:is(:where(img):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) {
10601072
border-radius: 0.5rem;
10611073
}
1074+
.markdown-picture\:rounded-lg
1075+
:is(:where(picture):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) {
1076+
border-radius: 0.5rem;
1077+
}
1078+
.markdown-images\:rounded-lg
1079+
:is(:where(img, picture > img):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) {
1080+
border-radius: 0.5rem;
1081+
}
10621082
.markdown-video\:my-12
10631083
:is(:where(video):not(:where([class~='not-markdown'], [class~='not-markdown'] *))) {
10641084
margin-top: 3rem;

0 commit comments

Comments
 (0)