Skip to content

Commit 36ea05b

Browse files
committed
Merge branch 'master' into rules-page-improvements
2 parents 8fe14a5 + 9c1d006 commit 36ea05b

File tree

14 files changed

+524
-45
lines changed

14 files changed

+524
-45
lines changed

harper-core/dictionary.dict

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34332,9 +34332,7 @@ nympho/1S
3433234332
nymphomania/1M
3433334333
nymphomaniac/15SM
3433434334
nymphs/14
34335-
o/15+
3433634335
o'clock/
34337-
o'er/+
3433834336
oaf/1SM
3433934337
oafish/5PY
3434034338
oafishness/1M

harper-core/src/linting/phrase_corrections.rs

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,13 @@ pub fn lint_group() -> LintGroup {
602602
["day and age"],
603603
"Use `day and age` for referring to the present time.",
604604
"Corrects the eggcorn `day in age` to `day and age`, which properly means the current era or time period."
605-
)
605+
),
606+
"NerveRacking" => (
607+
["nerve racking", "nerve wracking", "nerve wrecking", "nerve-wracking", "nerve-wrecking"],
608+
["nerve-racking"],
609+
"Use `nerve-racking` for something that causes anxiety or tension.",
610+
"Corrects common misspellings and missing hyphen in `nerve-racking`."
611+
),
606612
});
607613

608614
group.set_all_rules_to(Some(true));
@@ -780,4 +786,49 @@ mod tests {
780786
"This seems like a blanket statement and I have not found any info to back up whether PyJWT is affected.",
781787
);
782788
}
789+
790+
#[test]
791+
fn detect_nerve_wracking_hyphen() {
792+
assert_suggestion_result(
793+
"We've gone through several major changes / upgrades to atlantis, and it's always a little bit nerve-wracking because if we mess something up we ...",
794+
lint_group(),
795+
"We've gone through several major changes / upgrades to atlantis, and it's always a little bit nerve-racking because if we mess something up we ...",
796+
);
797+
}
798+
799+
#[test]
800+
fn detect_nerve_wrecking_hyphen() {
801+
assert_suggestion_result(
802+
"The issue happens to me on a daily basis, and it is nerve-wrecking because I become unsure if I have actually saved the diagram, but every time ...",
803+
lint_group(),
804+
"The issue happens to me on a daily basis, and it is nerve-racking because I become unsure if I have actually saved the diagram, but every time ...",
805+
);
806+
}
807+
808+
#[test]
809+
fn detect_nerve_wracking_no_hyphen() {
810+
assert_suggestion_result(
811+
"Very nerve wracking landing in an unfamiliar mountainous airport in dead of night with no radar to show surrounding terrain.",
812+
lint_group(),
813+
"Very nerve-racking landing in an unfamiliar mountainous airport in dead of night with no radar to show surrounding terrain.",
814+
);
815+
}
816+
817+
#[test]
818+
fn detect_nerve_wrecking_no_hyphen() {
819+
assert_suggestion_result(
820+
"I appreciate any kind of help since this is kind of nerve wrecking.",
821+
lint_group(),
822+
"I appreciate any kind of help since this is kind of nerve-racking.",
823+
);
824+
}
825+
826+
#[test]
827+
fn detect_nerve_racking_no_hyphen() {
828+
assert_suggestion_result(
829+
"It's nerve racking to think about it because I have code inside the callback that resolves the member and somehow I feel like it's so ..",
830+
lint_group(),
831+
"It's nerve-racking to think about it because I have code inside the callback that resolves the member and somehow I feel like it's so ..",
832+
);
833+
}
783834
}

justfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ test-harperjs: build-harperjs
3737
yarn install
3838
yarn start
3939

40+
dev-wp: build-harperjs
41+
#! /bin/bash
42+
43+
set -eo pipefail
44+
45+
cd "{{justfile_directory()}}/packages/wordpress-plugin"
46+
yarn install -f
47+
yarn run wp-now start &
48+
yarn start
49+
4050
# Build the WordPress plugin
4151
build-wp: build-harperjs
4252
#! /bin/bash

packages/web/demo_wp_blueprint.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
3+
"preferredVersions": {
4+
"php": "8.0",
5+
"wp": "6.7"
6+
},
7+
"meta": {
8+
"title": "Demo of Harper for WordPress",
9+
"description": "Harper is a grammar checker for people who want to write, without any fuss.",
10+
"author": "elijah-potter",
11+
"categories": []
12+
},
13+
"landingPage": "/wp-admin/post.php?post=4&action=edit",
14+
"steps": [
15+
{
16+
"step": "login",
17+
"username": "admin",
18+
"password": "password"
19+
},
20+
{
21+
"step": "installPlugin",
22+
"pluginData": {
23+
"resource": "url",
24+
"url": "https://github.com/Automattic/harper/releases/download/v0.24.0/harper.zip"
25+
},
26+
"options": {
27+
"activate": true
28+
}
29+
},
30+
{
31+
"step": "installTheme",
32+
"themeData": {
33+
"resource": "wordpress.org/themes",
34+
"slug": "twentytwentyfour"
35+
}
36+
},
37+
{
38+
"step": "runPHP",
39+
"code": "<?php require_once 'wordpress/wp-load.php'; wp_insert_post(array('post_title' => 'Harper, in WordPress', 'post_content' => '<!-- wp:paragraph --><p><strong>Click on the Harper button on the top right of this page to get started.</strong></p><!-- /wp:paragraph --><!-- wp:paragraph --><p>Writing on the web can be scary. Theres a lot of competition for traffic and even a small grammatical mstake can be costly to your reputation and search rankings.</p><!-- /wp:paragraph --><!-- wp:paragraph --><p>That\\'s why we created Harper: an plugin to save you the embarassment. it can fix typos, serial commas and overall just make your life better.</p><!-- /wp:paragraph --><!-- wp:paragraph --><p>All that while respecting your privacy. You data should never leave Wordpress until you hit \"Publish\".</p><!-- /wp:paragraph -->'));"
40+
}
41+
]
42+
}

packages/web/src/routes/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
>, Neovim,
9191
<a href="https://github.com/Stef16Robbe/harper_zed">Zed</a>
9292
and
93-
<a href="/obsidian">Obsidian</a> integration is amazing.
93+
<a href="/docs/integrations/obsidian">Obsidian</a> integration is amazing.
9494
</span>
9595

9696
<img
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# WordPress Plugin
2+
3+
This page will describe most of what you need to know to build and develop the WordPress plugin locally.
4+
You do NOT need to have a WordPress installation on your machine (or hosted on a server, for that matter) to work on the Harper plugin.
5+
6+
Make sure you read the [introduction to contributing](./introduction) before opening a pull request.
7+
8+
## Notes
9+
10+
- The plugin does not have any kind of automated testing.
11+
- You can look at the project's [`justfile`](https://github.com/Automattic/harper/blob/master/justfile) to see exactly what running the `just` recipes below do.
12+
13+
## Prerequisites
14+
15+
Make sure to [set up your environment](./environment).
16+
17+
## Running the Plugin on Your Machine
18+
19+
You should have already run `just setup` to prepare your environment.
20+
All you need to do from here is run `just dev-wp`. This will:
21+
22+
- Download a local copy of the WordPress Playground to your machine
23+
- Build and start watching for changes to the plugin code.
24+
- Run WordPress, mounting the build directory to the Playground instance.
25+
26+
When you make changes to the plugin code, it will be rebuild and you will be able to reload the WordPress page to see your change.
27+
28+
:::info[Remember]
29+
The Harper WordPress plugin only works on the Gutenberg editor.
30+
You will need to draft or edit a post to see the option to open the sidebar.
31+
:::
32+
33+
![Open the Harper Sidebar](/images/harper_wp_sidebar_button.png)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script>
2+
import {Button} from "flowbite-svelte"
3+
</script>
4+
5+
# Harper for WordPress
6+
7+
Harper is now ready to be installed to the nearest WordPress site near you.
8+
It's still early days, so expect bugs.
9+
10+
Not ready to install it just yet?
11+
Visit our online demo to try writing a blog post with Harper.
12+
13+
<Button href='/wpdemo' target="_blank">Go to the Demo</Button>
14+
15+
## Your Voice Means Something
16+
17+
![A screenshot of the Harper WordPress Demo](/images/harper_wp_playground_screenshot.png)
18+
19+
Harper checks your work for grammatical errors. That's it.
20+
21+
Other grammar checkers try to strip out everything that makes your writing unique.
22+
We believe you should have the freedom to write what's on your mind, not what an LLM thinks you want to hear.
23+
Harper is designed to be fast and **get out of the way**.
24+
25+
<Button href='/wpdemo' target="_blank">Go to the Demo</Button>
26+
27+
## Installation
28+
29+
For now, can install Harper into WordPress by downloading `harper.zip` from [GitHub releases](https://github.com/Automattic/harper/releases/latest) and uploading it to your site.
30+
31+
Harper will be coming to the WordPress.org plugin directory soon. Hang tight!
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { redirect } from '@sveltejs/kit';
2+
import blueprint from '../../../demo_wp_blueprint.json?raw';
3+
4+
const base64Blueprint = btoa(blueprint);
5+
const playgroundUrl = `https://playground.wordpress.net/?mode=seamless#${base64Blueprint}`;
6+
7+
export function load() {
8+
redirect(302, playgroundUrl);
9+
}
Loading
Loading

0 commit comments

Comments
 (0)