Skip to content

Commit

Permalink
Merge branch '2.x-dev' into unify-the-navigation-api
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jul 12, 2024
2 parents 51dc2ed + 0a4b35b commit d44d2a3
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 21 deletions.
4 changes: 2 additions & 2 deletions docs/advanced-features/build-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/creating-content/compile-and-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ navigation:
label: "Compile & Deploy"
---

# Compile and Deploy your site
# Compile and Deploy Your Site

## Running the Build Command

Expand Down
2 changes: 1 addition & 1 deletion docs/creating-content/documentation-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion docs/creating-content/managing-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion docs/creating-content/static-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/digging-deeper/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ navigation:
priority: 25
---

# Customizing your Site
# Customizing Your Site

## Introduction

Expand Down
2 changes: 1 addition & 1 deletion docs/digging-deeper/navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
4 changes: 2 additions & 2 deletions docs/digging-deeper/updating-hyde.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/console-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<a name="route-list" style="display: inline-block; position: absolute; margin-top: -5rem;"></a>
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started/core-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -127,7 +127,7 @@ author: "Mr Hyde"
date: "2023-03-14"
---

## Markdown comes here
## Markdown Comes Here

Lorem ipsum dolor sit amet, etc.
```
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/front-matter.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ author:
website: https://example.com
---

## Markdown comes here
## Markdown Comes Here

Lorem ipsum dolor sit amet, etc.
```
Expand Down
23 changes: 16 additions & 7 deletions monorepo/scripts/docs/MarkdownFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
$warnings = [];

$headings = [];
$checksHeadings = false;
$fixesHeadings = false;
$checksHeadings = true;
$fixesHeadings = true;

class MarkdownFormatter
{
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit d44d2a3

Please sign in to comment.