Skip to content

Commit

Permalink
Convert smart quotes to dumb quotes
Browse files Browse the repository at this point in the history
Since we know have the smartypants plugin installed, we might as well
change qutoes in the source mdx files to "dumb quotes".

This commit also temporarily disables the running of proselint since
proselint complains about dumb quotes. There doesn't seem to be a way
to configure proselint on a per-directory level at the moment.

- amperser/proselint#381
- amperser/proselint#997
  • Loading branch information
shreyasminocha committed Mar 21, 2020
1 parent 5f0547b commit 28821bd
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .proselintrc
@@ -0,0 +1,5 @@
{
"checks": {
"typography.symbols.curly_quotes": false
}
}
6 changes: 3 additions & 3 deletions chapters/basics.mdx
Expand Up @@ -2,9 +2,9 @@ import Example from "../src/components/example";

## Basics

Regular expressions are typically formatted as `/<rules>/<flags>`. Often people will drop the slashes and the flags for brevity. Well get into the details of flags in a later chapter, but the one you need to now now is `g`, which stands for global.
Regular expressions are typically formatted as `/<rules>/<flags>`. Often people will drop the slashes and the flags for brevity. We'll get into the details of flags in a later chapter, but the one you need to now now is `g`, which stands for "global".

Lets start with a relatively simple regex: `/p/g`.
Let's start with a relatively simple regex: `/p/g`.

<Example source="p" flags="g">
<String>pancake</String>
Expand All @@ -14,7 +14,7 @@ Let’s start with a relatively simple regex: `/p/g`.
<String>Plum</String>
</Example>

As we can see, `/p/g` matches all lowercase `p` characters. Note that regexes are case sensitive by default. If the regex has one or more matches within the input string, it is said to match the regex. Think of the matches as an array, and whether an input matches a regex as a boolean.
As we can see, `/p/g` matches all lowercase `p` characters. Note that regexes are case sensitive by default. If the regex has one or more "matches" within the input string, it is said to "match" the regex. Think of "the matches" as an array, and whether an input "matches" a regex as a boolean.

<Example source="pp" flags="g">
<String>apple</String>
Expand Down
12 changes: 6 additions & 6 deletions chapters/character-classes.mdx
Expand Up @@ -2,7 +2,7 @@ import Example from "../src/components/example";

## Character classes

Its possible to match a character from one of several characters. Heres an example:
It's possible to match a character from one of several characters. Here's an example:

<Example source="[aeiou]" flags="g">
<String>avocado</String>
Expand All @@ -13,7 +13,7 @@ It’s possible to match a character from one of several characters. Here’s an

Our regex `/[aeiou]/g` matches all vowels in our input strings.

Heres another example of these in action:
Here's another example of these in action:

<Example source="p[aeiou]t" flags="g">
<String>pat</String>
Expand All @@ -26,7 +26,7 @@ Here’s another example of these in action:

We match a `p`, followed by one of the vowels, followed by a `t`.

Theres an intuitive shortcut for matching a character from within a continuous _range_.
There's an intuitive shortcut for matching a character from within a continuous _range_.

<Example source="[a-z]" flags="g">
<String>john_s</String>
Expand All @@ -53,7 +53,7 @@ Our regex `/[A-Za-z0-9_-]/g` matches a single character, which must be (at least
- from `0-9`
- one of `_` and `-`.

We can also negate these rules:
We can also "negate" these rules:

<Example source="[^aeiou]" flags="g">
<String>Umbrella</String>
Expand All @@ -63,10 +63,10 @@ We can also “negate” these rules:

The only difference between the first regex of this chapter and `/[^aeiou]/g` is the `^` immediately after the opening bracket. Its purpose is to negate the rules defined within the brackets. We are now saying:

> match any character that is _not_ any of _«blah»_, _«blah»_ or _«blah»_.
> "match any character that is _not_ any of _«blah»_, _«blah»_ or _«blah»_.
… instead of:

> match any character that is at least one of _«blah»_, _«blah»_ and _«blah»_
> "match any character that is at least one of _«blah»_, _«blah»_ and _«blah»_"
Here, _«blah»_ is either an individual character or a range of characters.
4 changes: 2 additions & 2 deletions chapters/groups.mdx
@@ -1,10 +1,10 @@
## Groups

Groups, as the name suggests, are meant to be used to group components of regular expressions. These groups can be used to:
Groups, as the name suggests, are meant to be used to "group" components of regular expressions. These groups can be used to:

- Extract subsets of matches
- Enhance readability
- Repeat groups an arbitrary number of times
- Make the group optional

Well see how to do a lot of this in later chapters, but learning how groups work will allow us to study some great examples in these later chapters.
We'll see how to do a lot of this in later chapters, but learning how groups work will allow us to study some great examples in these later chapters.
4 changes: 2 additions & 2 deletions chapters/repetition.mdx
Expand Up @@ -15,7 +15,7 @@ We can make parts of regex optional. We achieve this (among other things) using
<String>aaaaa</String>
</Example>

Heres another example:
Here's another example:

<Example source="https?" flags="g">
<String>http</String>
Expand Down Expand Up @@ -48,7 +48,7 @@ If we wish to match zero or more of a token, we can suffix it with a `*`.
<String>aaaaa</String>
</Example>

Our regex matches even an empty string `“”`.
Our regex matches even an empty string `""`.

### One or more

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -9,7 +9,7 @@
"alex": "alex chapters/*.mdx",
"lint-check": "prettier --ignore-path .gitignore --check '**/*.{css,js,md,mdx,yml}'",
"lint": "prettier --ignore-path .gitignore --write '**/*.{css,js,md,mdx,yml}'",
"test": "status=0; npm run spellcheck || status=$?; npm run proselint || status=$?; npm run alex || status=$?; npm run lint-check || status=$?; exit $status"
"test": "status=0; npm run spellcheck || status=$?; npm run alex || status=$?; npm run lint-check || status=$?; exit $status"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 28821bd

Please sign in to comment.