diff --git a/Readme.md b/Readme.md index c351d8612d..bdbb0662b4 100644 --- a/Readme.md +++ b/Readme.md @@ -233,21 +233,26 @@ $('[xml\\:id="main"'); ``` ### Rendering -When you're ready to render the document, you can use the `html` utility function: +When you're ready to render the document, you can call the `html` method on the "root" selection: ```js -$.html() -//=> +$.root().html() +//=> +// +// +// +// +// ``` -If you want to return the outerHTML you can use `$.html(selector)`: +If you want to render the [`outerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML) of a selection, you can use the `html` utility functon: ```js -$.html('.pear') +cheerio.html($('.pear')) //=>
  • Pear
  • ``` @@ -268,15 +273,7 @@ You may also render the text content of a Cheerio object using the `text` static ```js const $ = cheerio.load('This is content.') -$.text() -//=> This is content. -``` - -The method may be called on the Cheerio module itself--be sure to pass a collection of nodes! - -```js -const $ = cheerio.load('
    This is content.
    ') -cheerio.text($('div')) +cheerio.text($('body')) //=> This is content. ```