Skip to content

Commit a750550

Browse files
authored
Merge pull request #1357 from hydephp/add-markdown-configuration-options-for-tailwind-prose-classes
Add Markdown configuration option for the Tailwind prose classes
2 parents a1ae33e + e1b3425 commit a750550

File tree

7 files changed

+50
-4
lines changed

7 files changed

+50
-4
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This serves two purposes:
1010
2. At release time, you can move the Unreleased section changes into a new release version section.
1111

1212
### Added
13-
- for new features.
13+
- Added Markdown configuration option for the Tailwind prose classes in https://github.com/hydephp/develop/pull/1357
1414

1515
### Changed
1616
- for changes in existing functionality.

config/markdown.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,19 @@
8080
*/
8181

8282
'enable_blade' => false,
83+
84+
/*
85+
|--------------------------------------------------------------------------
86+
| Tailwind Typography Prose Classes
87+
|--------------------------------------------------------------------------
88+
|
89+
| HydePHP uses Tailwind Typography to style rendered Markdown.
90+
|
91+
| This setting controls the base classes to apply to all the HTML elements
92+
| containing rendered markdown. Please note that if you add any new
93+
| classes, you may need to recompile your CSS file.
94+
|
95+
*/
96+
97+
'prose_classes' => 'prose dark:prose-invert',
8398
];

docs/digging-deeper/advanced-markdown.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,18 @@ the `allow_html` option to `true` in your `config/markdown.php` file.
183183
```
184184

185185
This will add and configure the `DisallowedRawHtml` CommonMark extension so that no HTML tags are stripped out.
186+
187+
### Tailwind Typography Prose Classes
188+
189+
HydePHP uses the [Tailwind Typography](https://tailwindcss.com/docs/typography-plugin) to style rendered Markdown.
190+
We do this by adding the `.prose` CSS class to the HTML elements containing the rendered Markdown, using the built-in Blade components.
191+
192+
You can easily edit these classes, for example if you want to customize the prose colours, in the `config/markdown.php` file.
193+
194+
```php
195+
// filepath: config/markdown.php
196+
'prose_classes' => 'prose dark:prose-invert', // [tl! remove]
197+
'prose_classes' => 'prose dark:prose-invert prose-img:inline', // [tl! add]
198+
```
199+
200+
Please note that if you add any new classes, you may need to recompile your CSS file.

packages/framework/config/markdown.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,19 @@
8080
*/
8181

8282
'enable_blade' => false,
83+
84+
/*
85+
|--------------------------------------------------------------------------
86+
| Tailwind Typography Prose Classes
87+
|--------------------------------------------------------------------------
88+
|
89+
| HydePHP uses Tailwind Typography to style rendered Markdown.
90+
|
91+
| This setting controls the base classes to apply to all the HTML elements
92+
| containing rendered markdown. Please note that if you add any new
93+
| classes, you may need to recompile your CSS file.
94+
|
95+
*/
96+
97+
'prose_classes' => 'prose dark:prose-invert',
8398
];

packages/framework/resources/views/components/docs/documentation-article.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
@endphp
44

55
<article id="document" itemscope itemtype="https://schema.org/Article" @class([
6-
'mx-auto lg:ml-8 prose dark:prose-invert max-w-3xl p-12 md:px-16 max-w-[1000px] min-h-[calc(100vh_-_4rem)]',
6+
'mx-auto lg:ml-8 max-w-3xl p-12 md:px-16 max-w-[1000px] min-h-[calc(100vh_-_4rem)]',
7+
config('markdown.prose_classes', 'prose dark:prose-invert'),
78
'torchlight-enabled' => $document->hasTorchlight()])>
89
@yield('content')
910

packages/framework/resources/views/components/post/article.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<article aria-label="Article" id="{{ $page->identifier }}" itemscope
22
itemtype="https://schema.org/Article"
3-
@class(['post-article mx-auto prose dark:prose-invert', 'torchlight-enabled' => Features::hasTorchlight()])>
3+
@class(['post-article mx-auto', config('markdown.prose_classes', 'prose dark:prose-invert'), 'torchlight-enabled' => Features::hasTorchlight()])>
44
<meta itemprop="identifier" content="{{ $page->identifier }}">
55
@if($page->getCanonicalUrl() !== null)
66
<meta itemprop="url" content="{{ $page->getCanonicalUrl() }}">

packages/framework/resources/views/layouts/page.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@section('content')
44

55
<main id="content" class="mx-auto max-w-7xl py-16 px-8">
6-
<article @class(['mx-auto prose dark:prose-invert', 'torchlight-enabled' => Features::hasTorchlight()])>
6+
<article @class(['mx-auto', config('markdown.prose_classes', 'prose dark:prose-invert'), 'torchlight-enabled' => Features::hasTorchlight()])>
77
{{ $content }}
88
</article>
99
</main>

0 commit comments

Comments
 (0)