Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize and expand README #673

Merged
merged 2 commits into from
Feb 22, 2021
Merged

Reorganize and expand README #673

merged 2 commits into from
Feb 22, 2021

Conversation

danburzo
Copy link
Contributor

Fixes #672. I'll add some comments inline to clarify some decisions.

var JSDOM = require('jsdom').JSDOM;
var doc = new JSDOM("<body>Here's a bunch of text</body>", {
var { JSDOM } = require('jsdom');
var doc = new JSDOM("<body>Look at this cat: <img src='./cat.jpg'></body>", {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an <img> with a relative src to tie to the next paragraph, explaining the purpose of the url option in JSDOM.

In Node.js, you won't generally have a DOM document object. To obtain one, you can use external
libraries like [jsdom](https://github.com/jsdom/jsdom). While this repository contains a parser of
its own (`JSDOMParser`), that is restricted to reading XML-compatible markup and therefore we do
not recommend it for general use.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the mention of JSDOMParser — if I understand correctly, people don't actually need to know that it exists. It may be useful, however, to add a recipe for parsing XHTML with jsdom? I don't remember exactly, but by default it might choke on the weirder things in XHTML (CDATA sections, etc.)

}
```

## Node.js usage

Readability is available on npm:

```bash
npm install @mozilla/readability
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think currently the npm package is a bit buried under the fold, and people may be inclined to grab the other readability before reading. Maybe start with an Installation section, or work it into the Basic usage section?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either of those options sound good to me - I definitely agree moving this higher up is a good idea. I'll give this a shot after merging.

@danburzo
Copy link
Contributor Author

Alright, this would be my first pass. Looking for feedback, and otherwise feel free to just pull this in and modify as needed, if it saves time.

@gijsk
Copy link
Contributor

gijsk commented Feb 22, 2021

Awesome, thanks!

@gijsk gijsk merged commit c09880f into mozilla:master Feb 22, 2021
@danburzo danburzo deleted the reorganize-readme branch February 22, 2021 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reorganize README
2 participants