diff --git a/docs/advanced-features/build-tasks.md b/docs/advanced-features/build-tasks.md index cb052ce8b6f..8852b58aab1 100644 --- a/docs/advanced-features/build-tasks.md +++ b/docs/advanced-features/build-tasks.md @@ -150,11 +150,11 @@ class MyServiceProvider extends ServiceProvider } ``` -## Error handling +## Error Handling If an exception is thrown in a build task, the build command will catch it and display the error message to the user. -## Helper methods +## Helper Methods ### Output helpers diff --git a/docs/creating-content/compile-and-deploy.md b/docs/creating-content/compile-and-deploy.md index e3699c1dd2e..78e8fcaa014 100644 --- a/docs/creating-content/compile-and-deploy.md +++ b/docs/creating-content/compile-and-deploy.md @@ -4,7 +4,7 @@ navigation: label: "Compile & Deploy" --- -# Compile and Deploy your site +# Compile and Deploy Your Site ## Running the Build Command diff --git a/docs/creating-content/documentation-pages.md b/docs/creating-content/documentation-pages.md index f2e86881ab3..e71f5d9d710 100644 --- a/docs/creating-content/documentation-pages.md +++ b/docs/creating-content/documentation-pages.md @@ -153,7 +153,7 @@ For example, putting a Markdown file in `_docs/getting-started/`, is equivalent >info Tip: When using subdirectory-based dropdowns, you can set their priority using the directory name as the array key. -### Hiding items +### Hiding Items You can hide items from the sidebar by adding the `hidden` property to the front matter: diff --git a/docs/creating-content/managing-assets.md b/docs/creating-content/managing-assets.md index fbb97c067ea..a6eba76523e 100644 --- a/docs/creating-content/managing-assets.md +++ b/docs/creating-content/managing-assets.md @@ -53,7 +53,7 @@ It may seem weird to have two folders for storing the compiled assets, but it is The `_site` directory is intended to be excluded from version control, while the `_media` folder is included in the version control. You are of course free to modify this behaviour by editing the `webpack.mix.js` file to change the output directory. -## How Do I Compile assets? +## How Do I Compile Assets? First, make sure that you have installed all the NodeJS dependencies using `npm install`. Then run `npm run dev` to compile the assets. If you want to compile the assets for production, run `npm run prod`. diff --git a/docs/creating-content/static-pages.md b/docs/creating-content/static-pages.md index ea130f3df7a..8eef4a50093 100644 --- a/docs/creating-content/static-pages.md +++ b/docs/creating-content/static-pages.md @@ -18,7 +18,7 @@ Let's start with the basics. ### Best Practices and Hyde Expectations Since Hyde does a lot of things automatically, there are some things you may need -to keep in mind when creating blog posts so that you don't get unexpected results. +to keep in mind when creating pages so that you don't get unexpected results. #### Filenames diff --git a/docs/digging-deeper/customization.md b/docs/digging-deeper/customization.md index 8b42ca38b7c..19b78e541f7 100644 --- a/docs/digging-deeper/customization.md +++ b/docs/digging-deeper/customization.md @@ -4,7 +4,7 @@ navigation: priority: 25 --- -# Customizing your Site +# Customizing Your Site ## Introduction diff --git a/docs/digging-deeper/navigation.md b/docs/digging-deeper/navigation.md index 4c635796dfb..3b053cee297 100644 --- a/docs/digging-deeper/navigation.md +++ b/docs/digging-deeper/navigation.md @@ -336,7 +336,7 @@ If you're not interested in using numerical prefix ordering, you can disable it 'numerical_page_ordering' => false, ``` -## Digging Deeper into the Internals +## Digging Deeper Into the Internals While not essential, understanding the internal workings of the navigation system can be as beneficial as it's interesting. Here's a quick high-level overview of the [Navigation API](navigation-api). diff --git a/docs/digging-deeper/updating-hyde.md b/docs/digging-deeper/updating-hyde.md index 612f20f3fde..d957cd1f8dd 100644 --- a/docs/digging-deeper/updating-hyde.md +++ b/docs/digging-deeper/updating-hyde.md @@ -36,7 +36,7 @@ Obligatory related XKCD: [https://xkcd.com/1172](https://xkcd.com/1172) Before you perform an update, please make sure you have a backup of your project. Using Git is highly recommended as it allows you to easily roll back changes if something goes wrong. -## Update to a major version +## Update to a Major Version When updating to a major version, you should read the release notes and the upgrade guide for that version. If you are updating multiple major versions at once, it's recommended to update one major version at a time, @@ -53,7 +53,7 @@ composer update hyde/* --with-dependencies Note that if you have hardcoded a version constraint in your `composer.json` file, you may need to update it manually. You can always refer to the `composer.json` file in the HydePHP repository if you need a reference. -## Alternate update methods +## Alternate Update Methods ### Updating using Git (advanced) diff --git a/docs/getting-started/console-commands.md b/docs/getting-started/console-commands.md index bcdc5552f40..c6e4471c4eb 100644 --- a/docs/getting-started/console-commands.md +++ b/docs/getting-started/console-commands.md @@ -234,7 +234,7 @@ Publish the hyde components for customization. Note that existing files will be |------------|-------------------------| | `category` | The category to publish | -## Display all Registered Routes. +## Display All Registered Routes. diff --git a/docs/getting-started/core-concepts.md b/docs/getting-started/core-concepts.md index 9ebb4d9fd41..99d343fb6bc 100644 --- a/docs/getting-started/core-concepts.md +++ b/docs/getting-started/core-concepts.md @@ -100,7 +100,7 @@ This can be visualized as follows, assuming a blog post is stored as `_posts/hel As you can see, the route key is simply put the relative page URL, without the .html extension. -## Convention over Configuration +## Convention Over Configuration Hyde favours the "Convention over Configuration" paradigm and thus comes preconfigured with sensible defaults. However, Hyde also strives to be modular and endlessly customizable hackable if you need it. @@ -127,7 +127,7 @@ author: "Mr Hyde" date: "2023-03-14" --- -## Markdown comes here +## Markdown Comes Here Lorem ipsum dolor sit amet, etc. ``` diff --git a/docs/getting-started/front-matter.md b/docs/getting-started/front-matter.md index 31e335dfcc0..ea41a9fc581 100644 --- a/docs/getting-started/front-matter.md +++ b/docs/getting-started/front-matter.md @@ -51,7 +51,7 @@ author: website: https://example.com --- -## Markdown comes here +## Markdown Comes Here Lorem ipsum dolor sit amet, etc. ``` diff --git a/monorepo/scripts/docs/MarkdownFormatter.php b/monorepo/scripts/docs/MarkdownFormatter.php index 3a34c0e70ec..5d211ed7038 100644 --- a/monorepo/scripts/docs/MarkdownFormatter.php +++ b/monorepo/scripts/docs/MarkdownFormatter.php @@ -18,8 +18,8 @@ $warnings = []; $headings = []; -$checksHeadings = false; -$fixesHeadings = false; +$checksHeadings = true; +$fixesHeadings = true; class MarkdownFormatter { @@ -375,11 +375,16 @@ function processHeadings(): void continue; } - $expectedCase = $headingLevel < 3 ? Hyde\make_title($headingText) : Str::ucfirst($headingText); + // Skip some special cases that can't be formatted properly by the APA method + if (Str::contains($headingText, ['"', '`', '-', 'filepath'], true)) { + continue; + } + + $expectedCase = $headingLevel < 3 ? Str::apa($headingText) : Str::ucfirst($headingText); $expectedCase = adjustCaseForSpecialWords($expectedCase); if ($headingText !== $expectedCase) { - $caseType = $headingLevel < 3 ? 'title' : 'sentence'; + $caseType = $headingLevel <= 3 ? 'title' : 'sentence'; $warnings['Headings'][] = "Heading '$headingText' should be $caseType case in $filename (expected '$expectedCase')"; if ($fixesHeadings) { @@ -392,13 +397,17 @@ function processHeadings(): void function adjustCaseForSpecialWords(string $text): string { - $alwaysUppercase = ['PHP', 'HTML', 'CLI', 'API', 'YAML', 'XML', 'RSS', 'HydeKernel', 'GitHub']; - $alwaysLowercase = ['to', 'it']; + $alwaysUppercase = ['PHP', 'HTML', 'CLI', 'API', 'YAML', 'XML', 'RSS', 'HydeKernel', 'HydePage', 'GitHub', 'CI/CD', 'UI ', 'URL']; + $alwaysLowercase = ['to', 'it', 'and']; + $text = str_ireplace($alwaysLowercase, $alwaysLowercase, $text); $text = str_ireplace($alwaysUppercase, $alwaysUppercase, $text); - return str_ireplace($alwaysLowercase, $alwaysLowercase, $text); + $patches = ['item' => 'Item']; + + return strtr($text, $patches); } + function fixHeading(string $filename, string $heading, int $headingLevel, string $expectedCase): void { $headingHashes = str_repeat('#', $headingLevel);