diff --git a/.remarkrc b/.remarkrc new file mode 100644 index 00000000..8ed323bc --- /dev/null +++ b/.remarkrc @@ -0,0 +1,6 @@ +{ + "plugins": [ + "remark-preset-lint-recommended", + ["remark-lint-list-item-indent", false] + ] +} diff --git a/package.json b/package.json index f29d8354..88e6f7bb 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "main": "./dist/mercury.js", "scripts": { "lint": "if test \"$CI\" != \"true\" ; then eslint . --fix; fi", - "lint:ci": "eslint .", + "lint:ci": "remark . && eslint .", "lint-fix-quiet": "eslint --fix --quiet", "build": "yarn lint && rollup -c && yarn test:build", "build:web": "yarn lint && rollup -c rollup.config.web.js && yarn test:build:web", @@ -79,6 +79,9 @@ "nock": "^10.0.6", "ora": "^3.0.0", "prettier": "^1.15.3", + "remark-cli": "^6.0.1", + "remark-lint": "^6.0.4", + "remark-preset-lint-recommended": "^3.0.2", "requirejs": "^2.3.6", "rollup": "^1.1.0", "rollup-plugin-babel": "^4.0.1", @@ -125,6 +128,7 @@ "git add" ], "*.{json,css,md}": [ + "remark .", "prettier --write", "git add" ] diff --git a/src/extractors/custom/README.md b/src/extractors/custom/README.md index 1eece61b..488a0dad 100644 --- a/src/extractors/custom/README.md +++ b/src/extractors/custom/README.md @@ -8,18 +8,19 @@ Custom parsers allow you to write CSS selectors that will find the content you'r You can query for every field returned by the Mercury Parser: - - title - - author - - content - - date_published - - lead_image_url - - dek - - next_page_url - - excerpt +- title +- author +- content +- date_published +- lead_image_url +- dek +- next_page_url +- excerpt ### Using selectors #### Basic selectors + To demonstrate, let's start with something simple: Your selector for the page's title might look something like this: ```javascript @@ -41,12 +42,13 @@ As you might guess, the selectors key provides an array of selectors that Mercur The selector you choose should return one element. If more than one element is returned by your selector, it will fail (and Mercury will fall back to its generic extractor). #### Selecting an attribute -Sometimes the information you want to return lives in an element's attribute rather than its text — e.g., sometimes a more exact ISO-formatted date/time will be stored in an attribute of an element. + +Sometimes the information you want to return lives in an element's attribute rather than its text — e.g., sometimes a more exact ISO-formatted date/time will be stored in an attribute of an element. So your element looks like this: ```html -