-
Notifications
You must be signed in to change notification settings - Fork 633
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
Conversation
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>", { |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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. |
Awesome, thanks! |
Fixes #672. I'll add some comments inline to clarify some decisions.