Skip to content

Commit d65f3b1

Browse files
jbamptonadamschwartz
authored andcommitted
feat(CI): add a GitHub Action to lint the Markdown
- Lint Markdown for blank lines and code block languages - Add a `.markdownlint.yml` config file - Run Action on pull request only - Fix missing HTTPS on web.scraper.workers.dev links - Add missing comma
1 parent bd9b3b7 commit d65f3b1

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

.github/workflows/lint.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 🍞 Lint
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
markdownlint:
7+
name: 🥐 Markdown
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: 🚀 Use Node.js
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: '12.x'
15+
- run: npm install -g [email protected]
16+
- run: markdownlint '**/*.md' --ignore node_modules

.markdownlint.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# markdownlint-cli npm package
2+
# https://www.npmjs.com/package/markdownlint-cli
3+
# print
4+
# markdownlint '**/*.md' --ignore node_modules
5+
# fix basic errors
6+
# markdownlint '**/*.md' --ignore node_modules --fix
7+
MD007: false
8+
MD013: false
9+
MD024: false
10+
MD029: false
11+
MD033: false
12+
MD034: false

README.md

+7-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Web Scraper makes it effortless to scrape websites. You provide a URL and CSS selector and it will return you JSON containing the text contents of the matching elements. You can also scrape HTML attribute values by optionally specifying an attribute name.
44

5-
[Website →](http://web.scraper.workers.dev)
5+
[Website →](https://web.scraper.workers.dev)
66

77
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/adamschwartz/web.scraper.workers.dev)
88

@@ -53,14 +53,13 @@ Web Scraper makes it effortless to scrape websites. You provide a URL and CSS se
5353
}
5454
```
5555

56-
5756
## API
5857

59-
- Requests are made as `GET` against `http://web.scraper.workers.dev`.
58+
- Requests are made as `GET` against `https://web.scraper.workers.dev`.
6059
- There are <strong>two required</strong> query params, `url` and `selector`.
6160
- There are three optional query params, `attr`, `pretty` and `spaced`.
6261

63-
<pre><code>http://web.scraper.workers.dev
62+
<pre><code>https://web.scraper.workers.dev
6463
?<strong>url</strong>=https://example.com
6564
&<strong>selector</strong>=p
6665
&<strong>attr</strong>=title
@@ -124,7 +123,7 @@ If an `attr` is provided, the result will be a string matching only the first no
124123

125124
Consider the following DOM structure:
126125

127-
```
126+
```html
128127
<div><p>This is the first paragraph.</p><p>This is another paragraph.</p></div>
129128
```
130129

@@ -138,7 +137,6 @@ With `spaced` set to `true`, the result is:
138137

139138
```This is the first paragraph. This is another paragraph.```
140139

141-
142140
## Development
143141

144142
Web Scraper is powered by [Cloudflare Workers](https://workers.cloudflare.com), heavily utilizing [HTMLRewriter](https://developers.cloudflare.com/workers/reference/apis/html-rewriter/) for parsing the HTML and scraping the text.
@@ -147,24 +145,22 @@ To develop Web Scraper locally, pull down the repo, and follow these steps:
147145

148146
1. Installing the Workers CLI globally.
149147

150-
```
148+
```shell
151149
npm i @cloudflare/[email protected] -g
152150
```
153151

154152
2. Run the preview/watcher inside the repo:
155153

156-
```
154+
```shell
157155
wrangler preview --watch
158156
```
159157

160-
This will open up the Workers preview experience so you can test and debug the site. The main source can be found in `index.js`. As you make changes you’ll see them live in the previewer.
161-
158+
This will open up the Workers preview experience, so you can test and debug the site. The main source can be found in `index.js`. As you make changes you’ll see them live in the previewer.
162159

163160
## Deploying
164161

165162
Web Scraper is deployed automatically when changes are pushed to master using a [GitHub Action](https://github.com/features/actions) and the [Workers CLI](https://github.com/cloudflare/wrangler).
166163

167-
168164
## Author
169165

170166
Web Scraper was created by [Adam Schwartz](https://adamschwartz.co).

0 commit comments

Comments
 (0)