Skip to content

Commit f7510c8

Browse files
Add h5 and h6 options to plugin (#273)
* Update index.js Add h5 and h6 tag to index.js * Update index.js * Add test * Update changelog Co-authored-by: Jordan Pittman <[email protected]>
1 parent 88dca90 commit f7510c8

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- Add styles for `tfoot` elements ([#243](https://github.com/tailwindlabs/tailwindcss-typography/pull/243))
13+
- Add `prose-h5` and `prose-h6` variants ([#273](https://github.com/tailwindlabs/tailwindcss-typography/pull/273))
1314

1415
## Fixed
1516

@@ -18,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1819
- Fix generation of `prose-headings` variant ([#264](https://github.com/tailwindlabs/tailwindcss-typography/pull/264))
1920
- Fix `figure` spacing ([#267](https://github.com/tailwindlabs/tailwindcss-typography/pull/267))
2021
- Fix child combinator `:where` selectors ([#268](https://github.com/tailwindlabs/tailwindcss-typography/pull/267))
22+
- Fix `prose-headings` variant to include `h5` and `h6` elements ([#273](https://github.com/tailwindlabs/tailwindcss-typography/pull/273))
2123

2224
## [0.5.2] - 2022-02-14
2325

src/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ module.exports = plugin.withOptions(
8787
let options = { className, prefix }
8888

8989
for (let [name, ...selectors] of [
90-
['headings', 'h1', 'h2', 'h3', 'h4', 'th'],
90+
['headings', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'th'],
9191
['h1'],
9292
['h2'],
9393
['h3'],
9494
['h4'],
95+
['h5'],
96+
['h6'],
9597
['p'],
9698
['a'],
9799
['blockquote'],

src/index.test.js

+32-2
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,12 @@ test('legacy target', async () => {
435435
.prose-headings\:text-ellipsis h4 {
436436
text-overflow: ellipsis;
437437
}
438+
.prose-headings\:text-ellipsis h5 {
439+
text-overflow: ellipsis;
440+
}
441+
.prose-headings\:text-ellipsis h6 {
442+
text-overflow: ellipsis;
443+
}
438444
.prose-headings\:text-ellipsis th {
439445
text-overflow: ellipsis;
440446
}
@@ -621,7 +627,7 @@ test('element variants', async () => {
621627
font-weight: 700;
622628
}
623629
.prose-headings\:underline
624-
:is(:where(h1, h2, h3, h4, th):not(:where([class~='not-prose'] *))) {
630+
:is(:where(h1, h2, h3, h4, h5, h6, th):not(:where([class~='not-prose'] *))) {
625631
text-decoration-line: underline;
626632
}
627633
.prose-h1\:text-3xl :is(:where(h1):not(:where([class~='not-prose'] *))) {
@@ -793,7 +799,7 @@ test('element variants with custom class name', async () => {
793799
font-weight: 700;
794800
}
795801
.markdown-headings\:underline
796-
:is(:where(h1, h2, h3, h4, th):not(:where([class~='not-markdown'] *))) {
802+
:is(:where(h1, h2, h3, h4, h5, h6, th):not(:where([class~='not-markdown'] *))) {
797803
text-decoration-line: underline;
798804
}
799805
.markdown-h1\:text-3xl :is(:where(h1):not(:where([class~='not-markdown'] *))) {
@@ -970,3 +976,27 @@ it('should be possible to use nested syntax (&) when extending the config', () =
970976
`)
971977
})
972978
})
979+
980+
it('should be possible to specify custom h5 and h6 styles', () => {
981+
let config = {
982+
plugins: [typographyPlugin()],
983+
content: [
984+
{
985+
raw: html`<div class="prose prose-h5:text-sm prose-h6:text-xl"></div>`,
986+
},
987+
],
988+
}
989+
990+
return run(config).then((result) => {
991+
expect(result.css).toIncludeCss(css`
992+
.prose-h5\:text-sm :is(:where(h5):not(:where([class~='not-prose'] *))) {
993+
font-size: 0.875rem;
994+
line-height: 1.25rem;
995+
}
996+
.prose-h6\:text-xl :is(:where(h6):not(:where([class~='not-prose'] *))) {
997+
font-size: 1.25rem;
998+
line-height: 1.75rem;
999+
}
1000+
`)
1001+
})
1002+
})

0 commit comments

Comments
 (0)