diff --git a/.dockerignore b/.dockerignore
deleted file mode 100644
index d054c94b33..0000000000
--- a/.dockerignore
+++ /dev/null
@@ -1,8 +0,0 @@
-**
-
-!/package.json
-!/bin/build-site.js
-!/bin/install-jekyll.sh
-!/package-lock.json
-!/docs/Gemfile
-!/docs/Gemfile.lock
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index e422b22d7d..7110893cfc 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -28,11 +28,5 @@ jobs:
persist-credentials: false
- uses: ./.github/actions/install-node-package
with:
- node-version: 22
- - uses: ruby/setup-ruby@v1
- with:
- ruby-version: 2.7
- bundler-cache: true
- - run: sudo gem install bundler -v 2.1.4
- - run: npm run install-jekyll
+ node-version: 24
- run: BUILD=1 npm run build-site
diff --git a/.gitignore b/.gitignore
index 90f8ceec1e..a1758bd6f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,6 @@ tmp*
/node_modules
docs/_site
docs/static/css
-docs/.jekyll-cache
npm-debug.log
npm-debug.log.*
*~
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b3832063f0..4d90220191 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -97,16 +97,7 @@ Now when you visit https://github.com/myfork/pouchdb there should be a button th
Building PouchDB Documentation
--------------------------------------
-The source for the website http://pouchdb.com is stored inside the `docs` directory of the PouchDB repository, you can make changes and submit pull requests as with any other patch. To build and view the website locally you will need to have the Ruby development package installed.
-On Ubuntu this is done with:
-
- $ sudo apt install -y ruby-dev
-
-You then neet to install [jekyll](http://jekyllrb.com/) and a few other gems. Jekyll is installed using [bundler](http://bundler.io/) so you need to install that first.
-On Ubuntu you will need root permissions to do this so prefix the ```gem``` command with ```sudo```
-
- $ [sudo] gem install bundler
- $ npm run install-jekyll
+The source for the website http://pouchdb.com is stored inside the `docs` directory of the PouchDB repository, you can make changes and submit pull requests as with any other patch.
If you haven't already done so, you'll also need to run `npm install` to pull in packages for the dev server:
@@ -118,10 +109,6 @@ Now you can build the site and start the dev server with:
You should now find the documentation at http://127.0.0.1:4000
-You can also build and run the documentation with docker:
-
- $ npm run dev-site-with-docker
-
Writing a PouchDB Blog Post
--------------------------------------
@@ -166,7 +153,7 @@ Release Procedure
* `npm run set-version -- $VERSION`
* `npm run release`. Note that with 2FA in npm, it will request you an OTP for every package.
* Copy the `dist/pouchdb*` files from the $VERSION tag on github, paste the release notes and add the distribution files to Github Releases, rename `pouchdb.min.js` to `pouchdb-$VERSION.min.js` (same with `pouchdb.js`) after you upload it.
- * Update docs/_config.yml to the current version
+ * Update `docs/_data/site.yml` to the current version
* Push updated versions to master
* `npm run publish-site`
diff --git a/bin/build-site.js b/bin/build-site.js
index 94eea8a01d..55ca802c72 100755
--- a/bin/build-site.js
+++ b/bin/build-site.js
@@ -17,14 +17,6 @@ const POUCHDB_LESS = resolvePath('docs/src/less/pouchdb/pouchdb.less');
process.chdir('docs');
-async function checkJekyll() {
- try {
- await exec('bundle check');
- } catch (err) {
- throw new Error('Jekyll is not installed. You need to do: npm run install-jekyll');
- }
-}
-
async function buildCSS() {
fs.mkdirSync(__dirname + '/../docs/static/css', { recursive:true });
const cmd = [ resolvePath('node_modules/less/bin/lessc'), POUCHDB_LESS ].join(' ');
@@ -34,9 +26,9 @@ async function buildCSS() {
console.log('Updated:', POUCHDB_CSS);
}
-async function buildJekyll() {
- await exec('bundle exec jekyll build');
- console.log('=> Rebuilt jekyll');
+async function buildEleventy() {
+ await exec('npx @11ty/eleventy');
+ console.log('=> Rebuilt eleventy');
highlightEs6();
console.log('=> Highlighted ES6');
@@ -83,9 +75,8 @@ function onError(err) {
function buildEverything() {
return Promise.resolve()
- .then(checkJekyll)
.then(buildCSS)
- .then(buildJekyll)
+ .then(buildEleventy)
.catch(onError);
}
@@ -95,24 +86,25 @@ function resolvePath(projectLocalPath) {
if (!process.env.BUILD) {
const http_server = require('http-server');
- const watchGlob = require('glob-watcher');
+ const globWatcher = require('glob-watcher');
+ const watchGlob = (path, fn) => globWatcher(path, () => fn().catch(console.log));
// Simpler ways of blacklisting certain paths here would be very welcome.
fs.readdirSync('.')
.forEach(path => {
- if (path === '_site' || path.startsWith('Gemfile')) {
+ if (path === '_site') {
return;
}
if (fs.statSync(path).isDirectory()) {
- watchGlob(`${path}/**`, buildJekyll);
+ watchGlob(`${path}/**`, buildEleventy);
} else {
- watchGlob(path, buildJekyll);
+ watchGlob(path, buildEleventy);
}
});
- watchGlob('static/src/*/*.less', buildCSS);
+ watchGlob('src/less/**', buildCSS);
http_server.createServer({root: '_site', cache: '-1'}).listen(4000);
console.log('Server address: http://localhost:4000');
diff --git a/docs-dev.Dockerfile b/docs-dev.Dockerfile
deleted file mode 100644
index b5b49782de..0000000000
--- a/docs-dev.Dockerfile
+++ /dev/null
@@ -1,32 +0,0 @@
-# maintain similarity to CI by using common base image:
-FROM ubuntu:20.04
-
-RUN apt-get update && \
- apt-get --yes install \
- build-essential \
- curl \
- ruby-full \
- && \
- apt-get clean && \
- rm -rf /var/lib/apt/lists/*
-
-# TODO confirm ruby version is 2.7... if it matters
-RUN gem install bundler -v 2.1.4
-
-ENV NODE_VERSION=22.12.0
-ENV NVM_DIR=/root/.nvm
-RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
-RUN . "$NVM_DIR/nvm.sh" && nvm install 22
-ENV PATH="$NVM_DIR/versions/node/v${NODE_VERSION}/bin/:${PATH}"
-
-WORKDIR /pouchdb-docs
-
-COPY ./docs/ ./docs-bundler
-RUN cd docs-bundler && bundle install
-
-COPY package.json package-lock.json .
-RUN npm install --ci
-
-COPY ./bin/ ./bin/
-
-CMD ["npm", "run", "build-site"]
diff --git a/docs/Gemfile b/docs/Gemfile
deleted file mode 100644
index b43c8f4222..0000000000
--- a/docs/Gemfile
+++ /dev/null
@@ -1,10 +0,0 @@
-source 'https://rubygems.org'
-
-gem 'jekyll', '3.9.1'
-
-group :jekyll_plugins do
- gem 'jekyll-paginate'
- gem 'redcarpet'
-end
-
-gem 'json'
diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock
deleted file mode 100644
index 33f8d36e93..0000000000
--- a/docs/Gemfile.lock
+++ /dev/null
@@ -1,69 +0,0 @@
-GEM
- remote: https://rubygems.org/
- specs:
- addressable (2.8.6)
- public_suffix (>= 2.0.2, < 6.0)
- colorator (1.1.0)
- concurrent-ruby (1.2.3)
- em-websocket (0.5.3)
- eventmachine (>= 0.12.9)
- http_parser.rb (~> 0)
- eventmachine (1.2.7)
- ffi (1.16.3)
- forwardable-extended (2.6.0)
- http_parser.rb (0.8.0)
- i18n (0.9.5)
- concurrent-ruby (~> 1.0)
- jekyll (3.9.1)
- addressable (~> 2.4)
- colorator (~> 1.0)
- em-websocket (~> 0.5)
- i18n (~> 0.7)
- jekyll-sass-converter (~> 1.0)
- jekyll-watch (~> 2.0)
- kramdown (>= 1.17, < 3)
- liquid (~> 4.0)
- mercenary (~> 0.3.3)
- pathutil (~> 0.9)
- rouge (>= 1.7, < 4)
- safe_yaml (~> 1.0)
- jekyll-paginate (1.1.0)
- jekyll-sass-converter (1.5.2)
- sass (~> 3.4)
- jekyll-watch (2.2.1)
- listen (~> 3.0)
- json (2.3.1)
- kramdown (2.4.0)
- rexml
- liquid (4.0.4)
- listen (3.9.0)
- rb-fsevent (~> 0.10, >= 0.10.3)
- rb-inotify (~> 0.9, >= 0.9.10)
- mercenary (0.3.6)
- pathutil (0.16.2)
- forwardable-extended (~> 2.6)
- public_suffix (5.0.5)
- rb-fsevent (0.11.2)
- rb-inotify (0.10.1)
- ffi (~> 1.0)
- redcarpet (3.5.1)
- rexml (3.4.2)
- rouge (3.30.0)
- safe_yaml (1.0.5)
- sass (3.7.4)
- sass-listen (~> 4.0.0)
- sass-listen (4.0.0)
- rb-fsevent (~> 0.9, >= 0.9.4)
- rb-inotify (~> 0.9, >= 0.9.7)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- jekyll (= 3.9.1)
- jekyll-paginate
- json
- redcarpet
-
-BUNDLED WITH
- 2.1.4
diff --git a/docs/_config.yml b/docs/_config.yml
deleted file mode 100644
index 225bc17e8b..0000000000
--- a/docs/_config.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-name: PouchDB
-description: PouchDB, the JavaScript Database that Syncs!
-url: http://pouchdb.com
-markdown: redcarpet
-baseurl:
-version: 9.0.0
-paginate: 5
-paginate_path: "blog/page:num"
-github:
- repository_url: https://github.com/apache/pouchdb
-collections:
- guides:
- output: true
-exclude:
- - src
diff --git a/docs/_data/authors.json b/docs/_data/authors.json
new file mode 100644
index 0000000000..af09e0a5c2
--- /dev/null
+++ b/docs/_data/authors.json
@@ -0,0 +1,65 @@
+[
+ {
+ "name": "Nick Colley",
+ "twitter": "nickcolley",
+ "github": "nickcolley",
+ "www": "http://nickcolley.co.uk",
+ "gravatar": "d83613912d1a2511a784b99c703bdcf6"
+ },
+ {
+ "name": "Nolan Lawson",
+ "twitter": "nolanlawson",
+ "github": "nolanlawson",
+ "www": "http://nolanlawson.com",
+ "gravatar": "c436dec61b906e27c963518d0ef1d972"
+ },
+ {
+ "name": "Dale Harvey",
+ "twitter": "daleharvey",
+ "github": "daleharvey",
+ "www": "http://arandomurl.com",
+ "gravatar": "030451d8cfc268d666bae9a7fe8d10ec"
+ },
+ {
+ "name": "Calvin Metcalf",
+ "twitter": "CWMma",
+ "github": "calvinmetcalf",
+ "www": "http://calvinmetcalf.com/",
+ "gravatar": "e8153037a068f1c32e546f82729a64a5"
+ },
+ {
+ "name": "Giovanni Ornaghi",
+ "twitter": "sphaso",
+ "github": "sphaso",
+ "www": "https://it.linkedin.com/in/giovanniornaghi",
+ "gravatar": "da853b1ad9ebe5e1c3ab5b340bb63b70"
+ },
+ {
+ "name": "Garren Smith",
+ "twitter": "garrensmith",
+ "github": "garrensmith",
+ "www": "http://www.redcometlabs.com",
+ "gravatar": "15fb22e15587c7c36e0aeb5bf3579b07"
+ },
+ {
+ "name": "Will Holley",
+ "twitter": "wilhol",
+ "github": "willholley",
+ "www": "https://github.com/willholley/",
+ "gravatar": "059d287498c864868b910fb0db7c469b"
+ },
+ {
+ "name": "Gareth Bowen",
+ "twitter": "garethjtbowen",
+ "github": "garethbowen",
+ "www": "https://bowenwebdesign.co.nz",
+ "gravatar": "eda4874d50a06c7a6b231ba3dd29c7c0"
+ },
+ {
+ "name": "Alba Herrerías",
+ "twitter": "alba_dev",
+ "github": "AlbaHerrerias",
+ "www": "https://www.albaherrerias.dev",
+ "gravatar": "da81e745b26ae8ca53fc77538599510f"
+ }
+]
diff --git a/docs/_data/authors.yml b/docs/_data/authors.yml
deleted file mode 100644
index b4396b8529..0000000000
--- a/docs/_data/authors.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-- name: Nick Colley
- twitter: nickcolley
- github: nickcolley
- www: http://nickcolley.co.uk
- gravatar: d83613912d1a2511a784b99c703bdcf6
-
-- name: Nolan Lawson
- twitter: nolanlawson
- github: nolanlawson
- www: http://nolanlawson.com
- gravatar: c436dec61b906e27c963518d0ef1d972
-
-- name: Dale Harvey
- twitter: daleharvey
- github: daleharvey
- www: http://arandomurl.com
- gravatar: 030451d8cfc268d666bae9a7fe8d10ec
-
-- name: Calvin Metcalf
- twitter: CWMma
- github: calvinmetcalf
- www: http://calvinmetcalf.com/
- gravatar: e8153037a068f1c32e546f82729a64a5
-
-- name: Giovanni Ornaghi
- twitter: sphaso
- github: sphaso
- www: https://it.linkedin.com/in/giovanniornaghi
- gravatar: da853b1ad9ebe5e1c3ab5b340bb63b70
-
-- name: Garren Smith
- twitter: garrensmith
- github: garrensmith
- www: http://www.redcometlabs.com
- gravatar: 15fb22e15587c7c36e0aeb5bf3579b07
-
-- name: Will Holley
- twitter: wilhol
- github: willholley
- www: https://github.com/willholley/
- gravatar: 059d287498c864868b910fb0db7c469b
-
-- name: Gareth Bowen
- twitter: garethjtbowen
- github: garethbowen
- www: https://bowenwebdesign.co.nz
- gravatar: eda4874d50a06c7a6b231ba3dd29c7c0
-
-- name: Alba Herrerías
- twitter: alba_dev
- github: AlbaHerrerias
- www: https://www.albaherrerias.dev
- gravatar: da81e745b26ae8ca53fc77538599510f
diff --git a/docs/_data/site.json b/docs/_data/site.json
new file mode 100644
index 0000000000..ba2d582ebb
--- /dev/null
+++ b/docs/_data/site.json
@@ -0,0 +1,10 @@
+{
+ "name": "PouchDB",
+ "description": "PouchDB, the JavaScript Database that Syncs!",
+ "url": "http://pouchdb.com",
+ "baseurl": "",
+ "version": "9.0.0",
+ "github": {
+ "repository_url": "https://github.com/pouchdb/pouchdb"
+ }
+}
diff --git a/docs/_includes/api/active_tasks.html b/docs/_includes/api/active_tasks.html
index 673a8a8850..0d57da5b8a 100644
--- a/docs/_includes/api/active_tasks.html
+++ b/docs/_includes/api/active_tasks.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="List active tasks" hash="active_tasks" %}
-{% highlight js %}
+{% highlight "js" %}
PouchDB.activeTasks.list()
{% endhighlight %}
@@ -8,13 +8,13 @@
#### Example Usage:
-{% highlight js %}
+{% highlight "js" %}
const tasks = PouchDB.activeTasks.list()
{% endhighlight %}
#### Example Result:
-{% highlight js %}
+{% highlight "js" %}
[{
"id": "d81fea92-8ce4-42df-bb2b-89a4e67536c3",
"name": "database_compaction",
@@ -29,7 +29,7 @@
You can use [JavaScript Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) to monitor calls to the active tasks API. For the `PouchDB.activeTasks.add()` function, which is used internally to announce new tasks to PouchDB, you can monitor calls as follows:
-{% highlight js %}
+{% highlight "js" %}
PouchDB.activeTasks.add = new Proxy(PouchDB.activeTasks.add, {
apply: (target, thisArg, argumentsList) => {
const task = argumentsList[0];
diff --git a/docs/_includes/api/batch_create.html b/docs/_includes/api/batch_create.html
index 13f58a6abf..aa7510617f 100644
--- a/docs/_includes/api/batch_create.html
+++ b/docs/_includes/api/batch_create.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Create/update a batch of documents" hash="batch_create" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkDocs(docs, [options], [callback])
{% endhighlight %}
@@ -13,7 +13,7 @@
Put some new docs, providing the `_id`s:
{% include code/start.html id="bulk_docs_1" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkDocs([
{title : 'Lisa Says', _id: 'doc1'},
{title : 'Space Oddity', _id: 'doc2'}
@@ -25,7 +25,7 @@
{% include code/end.html %}
{% include code/start.html id="bulk_docs_1" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.bulkDocs([
{title : 'Lisa Says', _id: 'doc1'},
@@ -38,7 +38,7 @@
{% include code/end.html %}
{% include code/start.html id="bulk_docs_1" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkDocs([
{title : 'Lisa Says', _id: 'doc1'},
{title : 'Space Oddity', _id: 'doc2'}
@@ -53,7 +53,7 @@
Post some new docs and auto-generate the `_id`s:
{% include code/start.html id="bulk_docs_2" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkDocs([
{title : 'Lisa Says'},
{title : 'Space Oddity'}
@@ -65,7 +65,7 @@
{% include code/end.html %}
{% include code/start.html id="bulk_docs_2" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.bulkDocs([
{title : 'Lisa Says'},
@@ -78,7 +78,7 @@
{% include code/end.html %}
{% include code/start.html id="bulk_docs_2" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkDocs([
{title : 'Lisa Says'},
{title : 'Space Oddity'}
@@ -91,7 +91,7 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
[
{
"ok": true,
@@ -110,7 +110,7 @@
from the [put()/post() API](#create_document). If there are any errors, they
will be provided individually like so:
-{% highlight js %}
+{% highlight "js" %}
[
{ status: 409,
name: 'conflict',
@@ -131,7 +131,7 @@
You can also use `bulkDocs()` to update/delete many documents at once:
{% include code/start.html id="bulk_docs3" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkDocs([
{
title : 'Lisa Says',
@@ -153,7 +153,7 @@
{% include code/end.html %}
{% include code/start.html id="bulk_docs3" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.bulkDocs([
{
@@ -176,7 +176,7 @@
{% include code/end.html %}
{% include code/start.html id="bulk_docs3" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkDocs([
{
title : 'Lisa Says',
@@ -201,7 +201,7 @@
Or delete them:
{% include code/start.html id="bulk_docs_4" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkDocs([
{
title : 'Lisa Says',
@@ -223,7 +223,7 @@
{% include code/end.html %}
{% include code/start.html id="bulk_docs_4" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.bulkDocs([
{
@@ -246,7 +246,7 @@
{% include code/end.html %}
{% include code/start.html id="bulk_docs_4" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkDocs([
{
title : 'Lisa Says',
diff --git a/docs/_includes/api/batch_fetch.html b/docs/_includes/api/batch_fetch.html
index 0e7e6749ae..ce970a9407 100644
--- a/docs/_includes/api/batch_fetch.html
+++ b/docs/_includes/api/batch_fetch.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Fetch a batch of documents" hash="batch_fetch" %}
-{% highlight js %}
+{% highlight "js" %}
db.allDocs([options], [callback])
{% endhighlight %}
@@ -33,7 +33,7 @@
#### Example Usage:
{% include code/start.html id="all_docs" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.allDocs({
include_docs: true,
attachments: true
@@ -45,7 +45,7 @@
{% include code/end.html %}
{% include code/start.html id="all_docs" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.allDocs({
include_docs: true,
@@ -58,7 +58,7 @@
{% include code/end.html %}
{% include code/start.html id="all_docs" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.allDocs({
include_docs: true,
attachments: true
@@ -72,7 +72,7 @@
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"offset": 0,
"total_rows": 1,
@@ -109,7 +109,7 @@
You can use `startkey`/`endkey` to find all docs in a range:
{% include code/start.html id="all_docs_2" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.allDocs({
include_docs: true,
attachments: true,
@@ -123,7 +123,7 @@
{% include code/end.html %}
{% include code/start.html id="all_docs_2" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.allDocs({
include_docs: true,
@@ -138,7 +138,7 @@
{% include code/end.html %}
{% include code/start.html id="all_docs_2" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.allDocs({
include_docs: true,
attachments: true,
@@ -159,7 +159,7 @@
You can do prefix search in `allDocs()` – i.e. "give me all the documents whose `_id`s start with `'foo'`" – by using the special high Unicode character `'\ufff0'`:
{% include code/start.html id="all_docs_3" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.allDocs({
include_docs: true,
attachments: true,
@@ -173,7 +173,7 @@
{% include code/end.html %}
{% include code/start.html id="all_docs_3" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.allDocs({
include_docs: true,
@@ -188,7 +188,7 @@
{% include code/end.html %}
{% include code/start.html id="all_docs_3" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.allDocs({
include_docs: true,
attachments: true,
diff --git a/docs/_includes/api/bulk_get.html b/docs/_includes/api/bulk_get.html
index a664a3e1b3..d5cb826f1c 100644
--- a/docs/_includes/api/bulk_get.html
+++ b/docs/_includes/api/bulk_get.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Document bulk get" hash="bulk_get" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkGet(options, [callback])
{% endhighlight %}
@@ -21,7 +21,7 @@
#### Example Usage:
{% include code/start.html id="bulkget1" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkGet({
docs: [
{ id: "existing-doc", rev: "1-b2e54331db828310f3c772d6e042ac9c"},
@@ -36,7 +36,7 @@
{% include code/end.html %}
{% include code/start.html id="bulkget1" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.bulkGet({
docs: [
@@ -52,7 +52,7 @@
{% include code/end.html %}
{% include code/start.html id="bulkget1" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.bulkGet({
docs: [
{ id: "doc-that-exists", rev: "1-967a00dff5e02add41819138abb3284d"},
@@ -68,7 +68,7 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"results": [
{
diff --git a/docs/_includes/api/changes.html b/docs/_includes/api/changes.html
index 6bfbf69079..706c00cfe8 100644
--- a/docs/_includes/api/changes.html
+++ b/docs/_includes/api/changes.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Listen to database changes" hash="changes" %}
-{% highlight js %}
+{% highlight "js" %}
db.changes(options)
{% endhighlight %}
@@ -41,7 +41,7 @@
#### Example Usage:
-{% highlight js %}
+{% highlight "js" %}
const changes = db.changes({
since: 'now',
live: true,
@@ -58,7 +58,7 @@
{% endhighlight %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"id":"somestuff",
"seq":21,
@@ -83,7 +83,7 @@
Example response in the `'change'` listener (using `{include_docs: true}`):
-{% highlight js %}
+{% highlight "js" %}
{ id: 'doc1',
changes: [ { rev: '1-9152679630cc461b9477792d93b83eae' } ],
doc: {
@@ -96,7 +96,7 @@
Example response in the `'change'` listener when a doc was deleted:
-{% highlight js %}
+{% highlight "js" %}
{ id: 'doc2',
changes: [ { rev: '2-9b50a4b63008378e8d0718a9ad05c7af' } ],
doc: { _id: 'doc2',
@@ -110,7 +110,7 @@
Example response in the `'complete'` listener:
-{% highlight js %}
+{% highlight "js" %}
{
"results": [
{
@@ -147,7 +147,7 @@
returns a list of the changes (i.e. what the `'complete'` event emits):
{% include code/start.html id="changes1" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.changes({
limit: 10,
since: 0
@@ -159,7 +159,7 @@
{% include code/end.html %}
{% include code/start.html id="changes1" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.changes({
limit: 10,
@@ -172,7 +172,7 @@
{% include code/end.html %}
{% include code/start.html id="changes1" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.changes({
limit: 10,
since: 0
@@ -186,7 +186,7 @@
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"results": [{
"id": "0B3358C1-BA4B-4186-8795-9024203EB7DD",
@@ -242,7 +242,7 @@
In these examples, we'll work with some mammals. Let's imagine our docs are:
-{% highlight js %}
+{% highlight "js" %}
[
{_id: 'a', name: 'Kangaroo', type: 'marsupial'},
{_id: 'b', name: 'Koala', type: 'marsupial'},
@@ -258,7 +258,7 @@
Filter by `type === 'marsupial'`:
-{% highlight js %}
+{% highlight "js" %}
db.changes({
filter: function (doc) {
return doc.type === 'marsupial';
@@ -270,7 +270,7 @@
Filter documents with `_id`s `['a', 'c']`.
-{% highlight js %}
+{% highlight "js" %}
db.changes({
doc_ids: ['a', 'c']
});
@@ -280,7 +280,7 @@
First `put()` a design document:
-{% highlight js %}
+{% highlight "js" %}
{
_id: '_design/mydesign',
filters: {
@@ -293,7 +293,7 @@
Then filter by `type === 'marsupial'`:
-{% highlight js %}
+{% highlight "js" %}
db.changes({
filter: 'mydesign/myfilter'
});
@@ -305,7 +305,7 @@
First `put()` a design document:
-{% highlight js %}
+{% highlight "js" %}
{
_id: '_design/myfilter',
filters: {
@@ -318,7 +318,7 @@
Then filter by `type === 'marsupial'`:
-{% highlight js %}
+{% highlight "js" %}
db.changes({
filter: 'myfilter',
query_params: {type: 'marsupial'}
@@ -335,7 +335,7 @@
First `put()` a design document:
-{% highlight js %}
+{% highlight "js" %}
{
_id: '_design/mydesign',
views: {
@@ -350,7 +350,7 @@
Then filter by `type === 'marsupial'`:
-{% highlight js %}
+{% highlight "js" %}
db.changes({
filter: '_view',
view: 'mydesign/myview'
diff --git a/docs/_includes/api/close_database.html b/docs/_includes/api/close_database.html
index 3e82f1563e..71ff21d78c 100644
--- a/docs/_includes/api/close_database.html
+++ b/docs/_includes/api/close_database.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Close a database" hash="close_database"%}
-{% highlight js %}
+{% highlight "js" %}
db.close([callback])
{% endhighlight %}
@@ -9,7 +9,7 @@
#### Example Usage
{% include code/start.html id="close_db" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.close(function () {
// success
});
@@ -18,14 +18,14 @@
{% include code/start.html id="close_db" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
await db.close();
{% endhighlight %}
{% include code/end.html %}
{% include code/start.html id="close_db" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.close().then(function () {
// success
});
diff --git a/docs/_includes/api/compaction.html b/docs/_includes/api/compaction.html
index c936375d54..7b12671a18 100644
--- a/docs/_includes/api/compaction.html
+++ b/docs/_includes/api/compaction.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Compact the database" hash="compaction" %}
-{% highlight js %}
+{% highlight "js" %}
db.compact([options], [callback])
{% endhighlight %}
@@ -15,7 +15,7 @@
#### Example Usage:
{% include code/start.html id="compact" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.compact(function (err, result) {
if (err) { return console.log(err); }
// handle result
@@ -24,7 +24,7 @@
{% include code/end.html %}
{% include code/start.html id="compact" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.compact();
} catch (err) {
@@ -34,7 +34,7 @@
{% include code/end.html %}
{% include code/start.html id="compact" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.compact().then(function (result) {
// handle result
}).catch(function (err) {
@@ -44,6 +44,6 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{ "ok" : "true" }
{% endhighlight %}
diff --git a/docs/_includes/api/create_database.html b/docs/_includes/api/create_database.html
index faa17c5019..f29d88f2e7 100644
--- a/docs/_includes/api/create_database.html
+++ b/docs/_includes/api/create_database.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Create a database" hash="create_database" %}
-{% highlight js %}
+{% highlight "js" %}
new PouchDB([name], [options])
{% endhighlight %}
@@ -38,7 +38,7 @@
[levelup_options]: https://github.com/rvagg/node-levelup/#options
#### Example Usage:
-{% highlight js %}
+{% highlight "js" %}
const db = new PouchDB('dbname');
// or
const db = new PouchDB('http://localhost:5984/dbname');
@@ -46,13 +46,13 @@
Create an in-memory Pouch (must install `pouchdb-adapter-memory` first):
-{% highlight js %}
+{% highlight "js" %}
const db = new PouchDB('dbname', {adapter: 'memory'});
{% endhighlight %}
Create a remote PouchDB with special fetch options:
-{% highlight js %}
+{% highlight "js" %}
const db = new PouchDB('http://example.com/dbname', {
fetch: function (url, opts) {
opts.headers.set('X-Some-Special-Header', 'foo');
diff --git a/docs/_includes/api/create_document.html b/docs/_includes/api/create_document.html
index 6a377ead31..d0f2a61451 100644
--- a/docs/_includes/api/create_document.html
+++ b/docs/_includes/api/create_document.html
@@ -1,7 +1,7 @@
{% include anchor.html edit="true" title="Create/update a document" hash="create_document" %}
### Using db.put()
-{% highlight js %}
+{% highlight "js" %}
db.put(doc, [options], [callback])
{% endhighlight %}
@@ -16,7 +16,7 @@
Create a new doc with an `_id` of `'mydoc'`:
{% include code/start.html id="newDoc" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.put({
_id: 'mydoc',
title: 'Heroes'
@@ -28,7 +28,7 @@
{% include code/end.html %}
{% include code/start.html id="newDoc" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const response = await db.put({
_id: 'mydoc',
@@ -41,7 +41,7 @@
{% include code/end.html %}
{% include code/start.html id="newDoc" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.put({
_id: 'mydoc',
title: 'Heroes'
@@ -56,7 +56,7 @@
You can update an existing doc using `_rev`:
{% include code/start.html id="updateDoc" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.get('mydoc', function(err, doc) {
if (err) { return console.log(err); }
db.put({
@@ -72,7 +72,7 @@
{% include code/end.html %}
{% include code/start.html id="updateDoc" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const doc = await db.get('mydoc');
const response = await db.put({
@@ -88,7 +88,7 @@
{% include code/start.html id="updateDoc" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.get('mydoc').then(function(doc) {
return db.put({
_id: 'mydoc',
@@ -104,7 +104,7 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"ok": true,
"id": "mydoc",
@@ -117,7 +117,7 @@
### Using db.post()
-{% highlight js %}
+{% highlight "js" %}
db.post(doc, [options], [callback])
{% endhighlight %}
@@ -126,7 +126,7 @@
#### Example Usage:
{% include code/start.html id="post_doc" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.post({
title: 'Ziggy Stardust'
}, function (err, response) {
@@ -137,7 +137,7 @@
{% include code/end.html %}
{% include code/start.html id="post_doc" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const response = await db.post({
title: 'Ziggy Stardust'
@@ -149,7 +149,7 @@
{% include code/end.html %}
{% include code/start.html id="post_doc" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.post({
title: 'Ziggy Stardust'
}).then(function (response) {
@@ -161,7 +161,7 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"ok" : true,
"id" : "8A2C3761-FFD5-4770-9B8C-38C33CED300A",
diff --git a/docs/_includes/api/create_index.html b/docs/_includes/api/create_index.html
index 38b26a61f4..8c474728b9 100644
--- a/docs/_includes/api/create_index.html
+++ b/docs/_includes/api/create_index.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Create index" hash="create_index" %}
-{% highlight js %}
+{% highlight "js" %}
db.createIndex(index [, callback])
{% endhighlight %}
@@ -18,7 +18,7 @@
#### Example Usage:
{% include code/start.html id="create_idx" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.createIndex({
index: {
fields: ['foo']
@@ -31,7 +31,7 @@
{% include code/end.html %}
{% include code/start.html id="create_idx" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.createIndex({
index: {
@@ -45,7 +45,7 @@
{% include code/end.html %}
{% include code/start.html id="create_idx" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.createIndex({
index: {
fields: ['foo']
@@ -62,20 +62,20 @@
If the index was created, you'll see:
-{% highlight js %}
+{% highlight "js" %}
{ "result": "created" }
{% endhighlight %}
Or if the index already exists:
-{% highlight js %}
+{% highlight "js" %}
{ "result": "exists" }
{% endhighlight %}
You can also create an index on multiple fields:
{% include code/start.html id="create_idx2" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.createIndex({
index: {
fields: ['foo', 'bar', 'baz']
@@ -88,7 +88,7 @@
{% include code/end.html %}
{% include code/start.html id="create_idx2" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.createIndex({
index: {
@@ -102,7 +102,7 @@
{% include code/end.html %}
{% include code/start.html id="create_idx2" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.createIndex({
index: {
fields: ['foo', 'bar', 'baz']
@@ -118,7 +118,7 @@
Or an index on deep fields:
{% include code/start.html id="create_idx3" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.createIndex({
index: {
fields: ['person.address.zipcode']
@@ -131,7 +131,7 @@
{% include code/end.html %}
{% include code/start.html id="create_idx3" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.createIndex({
index: {
@@ -145,7 +145,7 @@
{% include code/end.html %}
{% include code/start.html id="create_idx3" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.createIndex({
index: {
fields: ['person.address.zipcode']
@@ -161,7 +161,7 @@
You can also specify additional options, if you want more control over how your index is created:
{% include code/start.html id="create_idx4" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.createIndex({
index: {
fields: ['foo', 'bar'],
@@ -177,7 +177,7 @@
{% include code/end.html %}
{% include code/start.html id="create_idx4" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.createIndex({
index: {
@@ -194,7 +194,7 @@
{% include code/end.html %}
{% include code/start.html id="create_idx4" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.createIndex({
index: {
fields: ['foo', 'bar'],
@@ -224,7 +224,7 @@
{% include alert/end.html%}
{% include code/start.html id="create_idx5" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.createIndex({
index: {
fields: ['year', 'title'],
@@ -240,7 +240,7 @@
{% include code/end.html %}
{% include code/start.html id="create_idx5" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = db.createIndex({
index: {
@@ -257,7 +257,7 @@
{% include code/end.html %}
{% include code/start.html id="create_idx5" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.createIndex({
index: {
fields: ['year', 'title'],
@@ -283,7 +283,7 @@
When a PouchDB instance updates an index, it emits `indexing` events that include information about the progress of the index update task.
-{% highlight js %}
+{% highlight "js" %}
const db = new PouchDB('my-docs');
db.on('indexing', function (event) {
diff --git a/docs/_includes/api/database_information.html b/docs/_includes/api/database_information.html
index e2cb79ff5f..a37926fd95 100644
--- a/docs/_includes/api/database_information.html
+++ b/docs/_includes/api/database_information.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Get database information" hash="database_information" %}
-{% highlight js %}
+{% highlight "js" %}
db.info([callback])
{% endhighlight %}
@@ -9,7 +9,7 @@
#### Example Usage:
{% include code/start.html id="dbinfo" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.info(function(err, info) {
if (err) { return console.log(err); }
// handle result
@@ -18,7 +18,7 @@
{% include code/end.html %}
{% include code/start.html id="dbinfo" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.info();
} catch (err) {
@@ -28,7 +28,7 @@
{% include code/end.html %}
{% include code/start.html id="dbinfo" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.info().then(function (result) {
// handle result
}).catch(function (err) {
@@ -38,7 +38,7 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"db_name": "test",
"doc_count": 4,
diff --git a/docs/_includes/api/defaults.html b/docs/_includes/api/defaults.html
index de2b22cab5..8012d10cdd 100644
--- a/docs/_includes/api/defaults.html
+++ b/docs/_includes/api/defaults.html
@@ -3,7 +3,7 @@
If you find yourself using the same constructor options repeatedly,
you can simplify your code with `PouchDB.defaults()`:
-{% highlight js %}
+{% highlight "js" %}
PouchDB.defaults({
option1: 'foo',
option2: 'value'
@@ -13,7 +13,7 @@
The returned object is a constructor function that works the same as `PouchDB`, except that whenever you invoke it (e.g. with `new`), the given options will be passed in by default.
#### Example Usage:
-{% highlight js %}
+{% highlight "js" %}
const MyMemPouch = PouchDB.defaults({
adapter: 'memory'
});
diff --git a/docs/_includes/api/delete_attachment.html b/docs/_includes/api/delete_attachment.html
index bceff6a70c..bebb5c2b5f 100644
--- a/docs/_includes/api/delete_attachment.html
+++ b/docs/_includes/api/delete_attachment.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Delete an attachment" hash="delete_attachment" %}
-{% highlight js %}
+{% highlight "js" %}
db.removeAttachment(docId, attachmentId, rev, [callback])
{% endhighlight %}
@@ -9,7 +9,7 @@
#### Example Usage:
{% include code/start.html id="delete_att" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
const rev = '1-068E73F5B44FEC987B51354DFC772891';
db.removeAttachment('doc', 'att.txt', rev, function(err, res) {
if (err) { return console.log(err); }
@@ -19,7 +19,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_att" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const rev = '1-068E73F5B44FEC987B51354DFC772891';
const result = await db.removeAttachment('doc', 'att.txt', rev);
@@ -30,7 +30,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_att" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
const rev = '1-068E73F5B44FEC987B51354DFC772891';
db.removeAttachment('doc', 'att.txt', rev).then(function (result) {
// handle result
@@ -42,7 +42,7 @@
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"ok": true,
"rev": "2-1F983211AB87EFCCC980974DFC27382F"
diff --git a/docs/_includes/api/delete_database.html b/docs/_includes/api/delete_database.html
index 69cca3cad8..5a6a94f0ea 100644
--- a/docs/_includes/api/delete_database.html
+++ b/docs/_includes/api/delete_database.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Delete a database" hash="delete_database"%}
-{% highlight js %}
+{% highlight "js" %}
db.destroy([options], [callback])
{% endhighlight %}
@@ -9,7 +9,7 @@
#### Example Usage
{% include code/start.html id="destroy_db" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.destroy(function (err, response) {
if (err) {
return console.log(err);
@@ -22,7 +22,7 @@
{% include code/start.html id="destroy_db" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
await db.destroy();
} catch (err) {
@@ -33,7 +33,7 @@
{% include code/start.html id="destroy_db" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.destroy().then(function (response) {
// success
}).catch(function (err) {
@@ -43,7 +43,7 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"ok" : true
}
diff --git a/docs/_includes/api/delete_document.html b/docs/_includes/api/delete_document.html
index c6e11c7c15..4005db0b70 100644
--- a/docs/_includes/api/delete_document.html
+++ b/docs/_includes/api/delete_document.html
@@ -1,12 +1,12 @@
{% include anchor.html edit="true" title="Delete a document" hash="delete_document"%}
-{% highlight js %}
+{% highlight "js" %}
db.remove(doc, [options], [callback])
{% endhighlight %}
Or:
-{% highlight js %}
+{% highlight "js" %}
db.remove(docId, docRev, [options], [callback])
{% endhighlight %}
@@ -18,7 +18,7 @@
#### Example Usage:
{% include code/start.html id="delete_doc" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.get('mydoc', function(err, doc) {
if (err) { return console.log(err); }
db.remove(doc, function(err, response) {
@@ -30,7 +30,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_doc" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const doc = await db.get('mydoc');
const response = await db.remove(doc);
@@ -41,7 +41,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_doc" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.get('mydoc').then(function(doc) {
return db.remove(doc);
}).then(function (result) {
@@ -54,7 +54,7 @@
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"ok": true,
"id": "mydoc",
@@ -65,7 +65,7 @@
You can also delete a document by just providing an `id` and `rev`:
{% include code/start.html id="delete_doc3" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.get('mydoc', function(err, doc) {
if (err) { return console.log(err); }
db.remove(doc._id, doc._rev, function(err, response) {
@@ -77,7 +77,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_doc3" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const doc = await db.get('mydoc');
const response = await db.remove(doc._id, doc._rev);
@@ -88,7 +88,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_doc3" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.get('mydoc').then(function(doc) {
return db.remove(doc._id, doc._rev);
}).then(function (result) {
@@ -102,7 +102,7 @@
You can also delete a document by using `put()` with `{_deleted: true}`:
{% include code/start.html id="delete_doc2" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.get('mydoc', function(err, doc) {
if (err) { return console.log(err); }
doc._deleted = true;
@@ -115,7 +115,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_doc2" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const doc = await db.get('mydoc');
doc._deleted = true;
@@ -127,7 +127,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_doc2" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.get('mydoc').then(function(doc) {
doc._deleted = true;
return db.put(doc);
diff --git a/docs/_includes/api/delete_index.html b/docs/_includes/api/delete_index.html
index 733bd743c1..b76448c80b 100644
--- a/docs/_includes/api/delete_index.html
+++ b/docs/_includes/api/delete_index.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Delete index" hash="delete_index" %}
-{% highlight js %}
+{% highlight "js" %}
db.deleteIndex(index [, callback])
{% endhighlight %}
@@ -19,7 +19,7 @@
#### Example Usage:
{% include code/start.html id="delete_idx" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.deleteIndex({
"ddoc": "_design/idx-0f3a6f73110868266fa5c688caf8acd3",
"name": "idx-0f3a6f73110868266fa5c688caf8acd3",
@@ -38,7 +38,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_idx" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.deleteIndex({
"ddoc": "_design/idx-0f3a6f73110868266fa5c688caf8acd3",
@@ -58,7 +58,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_idx" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.deleteIndex({
"ddoc": "_design/idx-0f3a6f73110868266fa5c688caf8acd3",
"name": "idx-0f3a6f73110868266fa5c688caf8acd3",
@@ -79,7 +79,7 @@
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{ "ok": true }
{% endhighlight %}
@@ -88,7 +88,7 @@
one after the built-in `_all_docs` index):
{% include code/start.html id="delete_idx2" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.getIndexes(function (err, indexesResult) {
if (err) { return console.log(err); }
db.deleteIndex(indexesResult.indexes[1], function (err, result) {
@@ -100,7 +100,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_idx2" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const indexesResult = await db.getIndexes();
const result = await db.deleteIndex(indexesResult.indexes[1]);
@@ -111,7 +111,7 @@
{% include code/end.html %}
{% include code/start.html id="delete_idx2" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.getIndexes().then(function (indexesResult) {
return db.deleteIndex(indexesResult.indexes[1]);
}).then(function (result) {
diff --git a/docs/_includes/api/events.html b/docs/_includes/api/events.html
index 1e7563e305..be755403d4 100644
--- a/docs/_includes/api/events.html
+++ b/docs/_includes/api/events.html
@@ -2,7 +2,7 @@
PouchDB is an [event emitter][event emitter] and will emit a `'created'` event when a database is created. A `'destroyed'` event is emitted when a database is destroyed.
-{% highlight js %}
+{% highlight "js" %}
PouchDB.on('created', function (dbName) {
// called whenever a db is created.
});
diff --git a/docs/_includes/api/explain_index.html b/docs/_includes/api/explain_index.html
index e79cd50e2c..ff40d1b818 100644
--- a/docs/_includes/api/explain_index.html
+++ b/docs/_includes/api/explain_index.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Explain index" hash="explain_index" %}
-{% highlight js %}
+{% highlight "js" %}
db.explain(request [, callback])
{% endhighlight %}
@@ -18,7 +18,7 @@
#### Example Usage:
{% include code/start.html id="explain_idx" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.explain({
selector: {
name: 'Mario',
@@ -34,7 +34,7 @@
{% include code/end.html %}
{% include code/start.html id="explain_idx" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const explanation = await db.explain({
selector: {
@@ -51,7 +51,7 @@
{% include code/end.html %}
{% include code/start.html id="explain_idx" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.explain({
selector: {
name: 'Mario',
@@ -69,7 +69,7 @@
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"dbname": "database-name"
"index": {
diff --git a/docs/_includes/api/fetch_document.html b/docs/_includes/api/fetch_document.html
index 0897a24f09..6d14d01e1f 100644
--- a/docs/_includes/api/fetch_document.html
+++ b/docs/_includes/api/fetch_document.html
@@ -1,7 +1,7 @@
{% include anchor.html edit="true" title="Fetch a document" hash="fetch_document"%}
-{% highlight js %}
+{% highlight "js" %}
db.get(docId, [options], [callback])
{% endhighlight %}
@@ -23,7 +23,7 @@
#### Example Usage:
{% include code/start.html id="get1" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.get('mydoc', function(err, doc) {
if (err) { return console.log(err); }
// handle doc
@@ -32,7 +32,7 @@
{% include code/end.html %}
{% include code/start.html id="get1" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const doc = await db.get('mydoc');
} catch (err) {
@@ -42,7 +42,7 @@
{% include code/end.html %}
{% include code/start.html id="get1" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.get('mydoc').then(function (doc) {
// handle doc
}).catch(function (err) {
@@ -52,7 +52,7 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"_id": "mydoc",
"_rev": "1-A6157A5EA545C99B00FF904EEF05FD9F"
diff --git a/docs/_includes/api/get_attachment.html b/docs/_includes/api/get_attachment.html
index 5578176228..1c8218a707 100644
--- a/docs/_includes/api/get_attachment.html
+++ b/docs/_includes/api/get_attachment.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Get an attachment" hash="get_attachment" %}
-{% highlight js %}
+{% highlight "js" %}
db.getAttachment(docId, attachmentId, [options], [callback])
{% endhighlight %}
@@ -15,7 +15,7 @@
Get an attachment with filename `'att.txt'` from document with ID `'doc'`:
{% include code/start.html id="get_att1" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.getAttachment('doc', 'att.txt', function(err, blobOrBuffer) {
if (err) { return console.log(err); }
// handle result
@@ -24,7 +24,7 @@
{% include code/end.html %}
{% include code/start.html id="get_att1" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const blobOrBuffer = await db.getAttachment('doc', 'att.txt');
} catch (err) {
@@ -34,7 +34,7 @@
{% include code/end.html %}
{% include code/start.html id="get_att1" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.getAttachment('doc', 'att.txt').then(function (blobOrBuffer) {
// handle result
}).catch(function (err) {
@@ -47,7 +47,7 @@
the revision `'1-abcd'`:
{% include code/start.html id="get_att2" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.getAttachment('doc', 'att.txt', {rev: '1-abcd'}, function(err, blobOrBuffer) {
if (err) { return console.log(err); }
// handle result
@@ -56,7 +56,7 @@
{% include code/end.html %}
{% include code/start.html id="get_att2" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const blobOrBuffer = await db.getAttachment('doc', 'att.txt', {rev: '1-abcd'});
} catch (err) {
@@ -66,7 +66,7 @@
{% include code/end.html %}
{% include code/start.html id="get_att2" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.getAttachment('doc', 'att.txt', {rev: '1-abcd'}).then(function (blobOrBuffer) {
// handle result
}).catch(function (err) {
@@ -83,7 +83,7 @@
You can specify `{attachments: true}` to most "read" operations, such as `get()`, `allDocs()`, `changes()`, and `query()`. The attachment data will then be included inlined in the resulting doc(s). However, it will always be supplied as base64. For example:
-{% highlight js %}
+{% highlight "js" %}
{
"_attachments": {
"att.txt": {
@@ -99,7 +99,7 @@
For such APIs, when you don't specify `{attachments: true}`, you will instead get metadata about the attachments. For example:
-{% highlight js %}
+{% highlight "js" %}
{
"_attachments": {
"att.txt": {
diff --git a/docs/_includes/api/list_indexes.html b/docs/_includes/api/list_indexes.html
index fa24c9be11..283195e35c 100644
--- a/docs/_includes/api/list_indexes.html
+++ b/docs/_includes/api/list_indexes.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="List indexes" hash="list_indexes" %}
-{% highlight js %}
+{% highlight "js" %}
db.getIndexes([callback])
{% endhighlight %}
@@ -19,7 +19,7 @@
#### Example Usage:
{% include code/start.html id="get_idxs" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.getIndexes(function (err, result) {
if (err) { return console.log(err); }
// handle result
@@ -28,7 +28,7 @@
{% include code/end.html %}
{% include code/start.html id="get_idxs" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.getIndexes();
} catch (err) {
@@ -38,7 +38,7 @@
{% include code/end.html %}
{% include code/start.html id="get_idxs" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.getIndexes().then(function (result) {
// handle result
}).catch(function (err) {
@@ -49,7 +49,7 @@
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"indexes": [
{
diff --git a/docs/_includes/api/overview.html b/docs/_includes/api/overview.html
index 02df9305fd..04a35649cd 100644
--- a/docs/_includes/api/overview.html
+++ b/docs/_includes/api/overview.html
@@ -5,7 +5,7 @@
Most of the API is exposed as:
-{% highlight js %}
+{% highlight "js" %}
db.doSomething(args..., [options], [callback])
{% endhighlight %}
@@ -15,7 +15,7 @@
Callbacks use the standard Node.js idiom of:
-{% highlight js %}
+{% highlight "js" %}
function(error, result) { /* ... */ }
{% endhighlight %}
@@ -35,7 +35,7 @@
To use a custom promise implementation with PouchDB, you must redefine a global `Promise` object before loading PouchDB:
-{% highlight html %}
+{% highlight "html" %}
{% endhighlight %}
@@ -46,7 +46,7 @@
Note that the samples for `async`/`await` in the API documentation assume that your code is inside an async function. So for instance:
-{% highlight js %}
+{% highlight "js" %}
async function myFunction() {
// your code goes in here
}
diff --git a/docs/_includes/api/plugins.html b/docs/_includes/api/plugins.html
index 06b29c1113..890db8ac51 100644
--- a/docs/_includes/api/plugins.html
+++ b/docs/_includes/api/plugins.html
@@ -12,7 +12,7 @@
Writing a plugin is easy! The API is:
-{% highlight js %}
+{% highlight "js" %}
PouchDB.plugin({
methodName: myFunction
});
@@ -23,7 +23,7 @@
There is a [PouchDB Plugin Seed project](https://github.com/pouchdb/plugin-seed), which is the fastest way to get started writing, building and testing your very own plugin.
#### Example Usage:
-{% highlight js %}
+{% highlight "js" %}
PouchDB.plugin({
sayHello : function () {
console.log("Hello!");
@@ -38,7 +38,7 @@
or attach event listeners to the `PouchDB` object.
#### Example Usage:
-{% highlight js %}
+{% highlight "js" %}
PouchDB.plugin(function (PouchDB) {
PouchDB.hello = 'world';
});
@@ -53,7 +53,7 @@
You can load plugins into PouchDB when you load it via `require()`.
-{% highlight js %}
+{% highlight "js" %}
const greet = {sayHello: function() { console.log("Hello!"); }};
const PouchDB = require('pouchdb').plugin(greet);
@@ -64,7 +64,7 @@
You can chain plugins, as well:
-{% highlight js %}
+{% highlight "js" %}
const greet = {sayHello: function() { console.log("Hello!"); }};
const manners = {thank: function(name) { console.log("Thank you, " + name); }};
@@ -85,7 +85,7 @@
Because PouchDB guarantees to plugin authors that all data changes ultimately happen via `bulkDocs()`, it is the ideal place for an application or plugin to intercept updates.
-{% highlight js %}
+{% highlight "js" %}
// Keep a reference to the "upstream" function.
const pouchBulkDocs = PouchDB.prototype.bulkDocs;
PouchDB.plugin({bulkDocs: validBulkDocs});
diff --git a/docs/_includes/api/purge.html b/docs/_includes/api/purge.html
index 54374a8026..27b7aeb270 100644
--- a/docs/_includes/api/purge.html
+++ b/docs/_includes/api/purge.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Purge a document rev" hash="purge" %}
-{% highlight js %}
+{% highlight "js" %}
db.purge(docId, rev)
{% endhighlight %}
@@ -23,7 +23,7 @@
#### Example Usage:
{% include code/start.html id="purge1" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.purge('mydoc', '6-3a24009a9525bde9e4bfa8a99046b00d',
function (err, result) {
if (err) { return console.log(err); }
@@ -33,7 +33,7 @@
{% include code/end.html %}
{% include code/start.html id="purge1" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.purge('mydoc', '6-3a24009a9525bde9e4bfa8a99046b00d');
// handle result
@@ -44,7 +44,7 @@
{% include code/end.html %}
{% include code/start.html id="purge1" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.purge('mydoc', '6-3a24009a9525bde9e4bfa8a99046b00d')
.then(function (result) {
// handle result
@@ -56,7 +56,7 @@
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"ok": true,
"deletedRevs": [
diff --git a/docs/_includes/api/query_database.html b/docs/_includes/api/query_database.html
index 073ce32fe0..0895330a56 100644
--- a/docs/_includes/api/query_database.html
+++ b/docs/_includes/api/query_database.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Map/reduce queries" hash="query_database" %}
-{% highlight js %}
+{% highlight "js" %}
db.query(fun, [options], [callback])
{% endhighlight %}
@@ -62,7 +62,7 @@
#### Example Usage:
{% include code/start.html id="query1" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
// create a design doc
const ddoc = {
_id: '_design/index',
@@ -96,7 +96,7 @@
{% include code/end.html %}
{% include code/start.html id="query1" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
// create a design doc
const ddoc = {
_id: '_design/index',
@@ -133,7 +133,7 @@
{% include code/end.html %}
{% include code/start.html id="query1" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
// create a design doc
const ddoc = {
_id: '_design/index',
@@ -169,7 +169,7 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"offset" : 0,
"rows": [{
@@ -197,7 +197,7 @@
You can also use [complex keys](https://docs.couchdb.org/en/stable/ddocs/views/collation.html#complex-keys) for fancy ordering:
{% include code/start.html id="query2" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
function map(doc) {
// sort by last name, first name, and age
emit([doc.lastName, doc.firstName, doc.age]);
@@ -210,7 +210,7 @@
{% include code/end.html %}
{% include code/start.html id="query2" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
function map(doc) {
// sort by last name, first name, and age
emit([doc.lastName, doc.firstName, doc.age]);
@@ -224,7 +224,7 @@
{% include code/end.html %}
{% include code/start.html id="query2" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
function map(doc) {
// sort by last name, first name, and age
emit([doc.lastName, doc.firstName, doc.age]);
@@ -238,7 +238,7 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"offset": 0,
"rows": [{
@@ -271,7 +271,7 @@
PouchDB fully supports [linked documents](https://docs.couchdb.org/en/stable/ddocs/views/joins.html?highlight=linked%20documents#linked-documents). Use them to join two types of documents together, by simply adding an `_id` to the emitted value:
{% include code/start.html id="query3" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
function map(doc) {
// join artist data to albums
if (doc.type === 'album') {
@@ -286,7 +286,7 @@
{% include code/end.html %}
{% include code/start.html id="query3" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
function map(doc) {
// join artist data to albums
if (doc.type === 'album') {
@@ -302,7 +302,7 @@
{% include code/end.html %}
{% include code/start.html id="query3" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
function map(doc) {
// join artist data to albums
if (doc.type === 'album') {
@@ -319,7 +319,7 @@
#### Example response:
-{% highlight js %}
+{% highlight "js" %}
{
"offset": 0,
"rows": [
@@ -378,7 +378,7 @@
If you pass a function to `db.query` and give it the `emit` function as the second argument, then you can use a closure. (Since PouchDB has to use `eval()` to bind `emit`.)
{% include code/start.html id="query4" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
// BAD! will throw error
const myId = 'foo';
db.query(function(doc) {
@@ -403,7 +403,7 @@
{% include code/end.html %}
{% include code/start.html id="query4" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
// BAD! will throw error
const myId = 'foo';
try {
@@ -431,7 +431,7 @@
{% include code/end.html %}
{% include code/start.html id="query4" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
// BAD! will throw error
const myId = 'foo';
db.query(function(doc) {
diff --git a/docs/_includes/api/query_index.html b/docs/_includes/api/query_index.html
index 7ea7ca8b8a..3ee32da6b7 100644
--- a/docs/_includes/api/query_index.html
+++ b/docs/_includes/api/query_index.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Query index" hash="query_index" %}
-{% highlight js %}
+{% highlight "js" %}
db.find(request [, callback])
{% endhighlight %}
@@ -18,7 +18,7 @@
#### Example Usage:
{% include code/start.html id="query_idx" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {name: 'Mario'},
fields: ['_id', 'name'],
@@ -31,7 +31,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.find({
selector: {name: 'Mario'},
@@ -45,7 +45,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {name: 'Mario'},
fields: ['_id', 'name'],
@@ -60,7 +60,7 @@
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"docs": [
{
@@ -104,7 +104,7 @@
If there's no index that matches your `selector`/`sort`, then this method will issue a warning:
-{% highlight js %}
+{% highlight "js" %}
{
"docs": [ /* ... */ ],
"warning": "No matching index found, create an index to optimize query time."
@@ -121,7 +121,7 @@
Use `$eq` for "equals":
{% include code/start.html id="query_idx2" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {name: {$eq: 'Mario'}}
}, function (err, result) {
@@ -132,7 +132,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx2" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.find({
selector: {name: {$eq: 'Mario'}}
@@ -144,7 +144,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx2" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {name: {$eq: 'Mario'}}
}).then(function (result) {
@@ -158,7 +158,7 @@
This is equivalent to:
{% include code/start.html id="query_idx3" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {name: 'Mario'}
}, function (err, result) {
@@ -169,7 +169,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx3" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.find({
selector: {name: 'Mario'}
@@ -181,7 +181,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx3" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {name: 'Mario'}
}).then(function (result) {
@@ -196,7 +196,7 @@
find all docs where `series` is `'Mario'` and `debut` is greater than `1990`:
{% include code/start.html id="query_idx4" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {
series: 'Mario',
@@ -210,7 +210,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx4" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.find({
selector: {
@@ -225,7 +225,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx4" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {
series: 'Mario',
@@ -242,7 +242,7 @@
This is equivalent to:
{% include code/start.html id="query_idx5" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {
$and: [
@@ -258,7 +258,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx5" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.find({
selector: {
@@ -275,7 +275,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx5" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {
$and: [
@@ -294,7 +294,7 @@
You can also sort the returned documents. For instance, to find all docs sorted by `debut` descending:
{% include code/start.html id="query_idx6" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {
debut: {'$gte': null}
@@ -308,7 +308,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx6" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.find({
selector: {
@@ -323,7 +323,7 @@
{% include code/end.html %}
{% include code/start.html id="query_idx6" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.find({
selector: {
debut: {'$gte': null}
diff --git a/docs/_includes/api/replication.html b/docs/_includes/api/replication.html
index 7ee4284e07..4beea78eb9 100644
--- a/docs/_includes/api/replication.html
+++ b/docs/_includes/api/replication.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Replicate a database" hash="replication" %}
-{% highlight js %}
+{% highlight "js" %}
PouchDB.replicate(source, target, [options])
{% endhighlight %}
@@ -36,7 +36,7 @@
#### Example Usage:
-{% highlight js %}
+{% highlight "js" %}
const rep = PouchDB.replicate('mydb', 'http://localhost:5984/mydb', {
live: true,
retry: true
@@ -59,7 +59,7 @@
There are also shorthands for replication given existing PouchDB objects. These behave the same as `PouchDB.replicate()`:
-{% highlight js %}
+{% highlight "js" %}
db.replicate.to(remoteDB, [options]);
// or
db.replicate.from(remoteDB, [options]);
@@ -82,7 +82,7 @@
As with [changes()](#changes), you can also omit `live`, in which case you can use `replicate()` in the callback/promise style and it will be treated as a single-shot operation.
{% include code/start.html id="replication1" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.replicate.to(remote, function (err, result) {
if (err) { return console.log(err); }
// handle 'completed' result
@@ -91,7 +91,7 @@
{% include code/end.html %}
{% include code/start.html id="replication1" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.replicate.to(remote);
} catch (err) {
@@ -101,7 +101,7 @@
{% include code/end.html %}
{% include code/start.html id="replication1" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.replicate.to(remote).then(function (result) {
// handle 'completed' result
}).catch(function (err) {
@@ -116,7 +116,7 @@
Example response in the `'change'` listener:
-{% highlight js %}
+{% highlight "js" %}
{
"doc_write_failures": 0,
"docs_read": 1,
@@ -135,7 +135,7 @@
Example response in the `'complete'` listener:
-{% highlight js %}
+{% highlight "js" %}
{
"doc_write_failures": 0,
"docs_read": 2,
@@ -181,7 +181,7 @@
In these examples, we'll work with some mammals. Let's imagine our docs are:
-{% highlight js %}
+{% highlight "js" %}
[
{_id: 'a', name: 'Kangaroo', type: 'marsupial'},
{_id: 'b', name: 'Koala', type: 'marsupial'},
@@ -197,7 +197,7 @@
Filter by `type === 'marsupial'`:
-{% highlight js %}
+{% highlight "js" %}
remote.replicate.to(local, {
filter: function (doc) {
return doc.type === 'marsupial';
@@ -209,7 +209,7 @@
Filter documents with `_id`s `['a', 'c']`.
-{% highlight js %}
+{% highlight "js" %}
remote.replicate.to(local, {
doc_ids: ['a', 'c']
});
@@ -219,7 +219,7 @@
First `put()` a design document in the remote database:
-{% highlight js %}
+{% highlight "js" %}
{
_id: '_design/mydesign',
filters: {
@@ -232,7 +232,7 @@
Then filter by `type === 'marsupial'`:
-{% highlight js %}
+{% highlight "js" %}
remote.replicate.to(local, {
filter: 'mydesign/myfilter'
});
@@ -244,7 +244,7 @@
First `put()` a design document in the remote database:
-{% highlight js %}
+{% highlight "js" %}
{
_id: '_design/mydesign',
filters: {
@@ -257,7 +257,7 @@
Then filter by `type === 'marsupial'`:
-{% highlight js %}
+{% highlight "js" %}
remote.replicate.to(local, {
filter: 'mydesign/myfilter',
query_params: {type: 'marsupial'}
@@ -272,7 +272,7 @@
First `put()` a design document in the remote database:
-{% highlight js %}
+{% highlight "js" %}
{
_id: '_design/mydesign',
views: {
@@ -289,7 +289,7 @@
Then filter by `type === 'marsupial'`:
-{% highlight js %}
+{% highlight "js" %}
remote.replicate.to(local, {
filter: '_view',
view: 'mydesign/myview'
@@ -302,7 +302,7 @@
Here's a simple backoff function that starts at 1000 milliseconds and triples it every time a remote request fails:
-{% highlight js %}
+{% highlight "js" %}
db.replicate.to(remote, {
live: true,
diff --git a/docs/_includes/api/revisions_diff.html b/docs/_includes/api/revisions_diff.html
index 9bd6c45607..61a649a55e 100644
--- a/docs/_includes/api/revisions_diff.html
+++ b/docs/_includes/api/revisions_diff.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Document revisions diff" hash="revisions_diff" %}
-{% highlight js %}
+{% highlight "js" %}
db.revsDiff(diff, [callback])
{% endhighlight %}
@@ -10,7 +10,7 @@
#### Example Usage:
{% include code/start.html id="revsdiff1" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.revsDiff({
myDoc1: [
"1-b2e54331db828310f3c772d6e042ac9c",
@@ -24,7 +24,7 @@
{% include code/end.html %}
{% include code/start.html id="revsdiff1" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.revsDiff({
myDoc1: [
@@ -39,7 +39,7 @@
{% include code/end.html %}
{% include code/start.html id="revsdiff1" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.revsDiff({
myDoc1: [
"1-b2e54331db828310f3c772d6e042ac9c",
@@ -54,7 +54,7 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"myDoc1": {
"missing": ["2-3a24009a9525bde9e4bfa8a99046b00d"]
diff --git a/docs/_includes/api/save_attachment.html b/docs/_includes/api/save_attachment.html
index 3f2ac38207..4cba436a3f 100644
--- a/docs/_includes/api/save_attachment.html
+++ b/docs/_includes/api/save_attachment.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Save an attachment" hash="save_attachment" %}
-{% highlight js %}
+{% highlight "js" %}
db.putAttachment(docId, attachmentId, [rev], attachment, type, [callback]);
{% endhighlight %}
@@ -15,7 +15,7 @@
#### Example Usage:
{% include code/start.html id="attach1" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
const attachment = new Blob(['Is there life on Mars?'], {type: 'text/plain'});
db.putAttachment('doc', 'att.txt', attachment, 'text/plain', function(err, res) {
if (err) { return console.log(err); }
@@ -25,7 +25,7 @@
{% include code/end.html %}
{% include code/start.html id="attach1" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const attachment = new Blob(['Is there life on Mars?'], {type: 'text/plain'});
const result = await db.putAttachment('doc', 'att.txt', attachment, 'text/plain');
@@ -36,7 +36,7 @@
{% include code/end.html %}
{% include code/start.html id="attach1" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
const attachment = new Blob(['Is there life on Mars?'], {type: 'text/plain'});
db.putAttachment('doc', 'att.txt', attachment, 'text/plain').then(function (result) {
// handle result
@@ -48,7 +48,7 @@
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{
"ok": true,
"id": "doc",
@@ -58,7 +58,7 @@
Within Node, you must use a `Buffer` instead of a `Blob`:
-{% highlight js %}
+{% highlight "js" %}
const attachment = new Buffer('Is there life on Mars?');
{% endhighlight %}
@@ -71,7 +71,7 @@
If you supply a string instead of a `Blob`/`Buffer`, then it will be assumed to be a base64-encoded string, and will be processed accordingly:
{% include code/start.html id="attach3" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
const attachment =
"TGVnZW5kYXJ5IGhlYXJ0cywgdGVhciB1cyBhbGwgYXBhcnQKTWFrZS" +
"BvdXIgZW1vdGlvbnMgYmxlZWQsIGNyeWluZyBvdXQgaW4gbmVlZA==";
@@ -83,7 +83,7 @@
{% include code/end.html %}
{% include code/start.html id="attach3" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const attachment =
"TGVnZW5kYXJ5IGhlYXJ0cywgdGVhciB1cyBhbGwgYXBhcnQKTWFrZS" +
@@ -96,7 +96,7 @@
{% include code/end.html %}
{% include code/start.html id="attach3" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
const attachment =
"TGVnZW5kYXJ5IGhlYXJ0cywgdGVhciB1cyBhbGwgYXBhcnQKTWFrZS" +
"BvdXIgZW1vdGlvbnMgYmxlZWQsIGNyeWluZyBvdXQgaW4gbmVlZA==";
@@ -114,7 +114,7 @@
You can also inline attachments inside the document. The attachment data may be supplied as a base64-encoded string with the `content_type`:
{% include code/start.html id="attach2" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
const doc = {
"_id": "doc",
"title": "Legendary Hearts",
@@ -134,7 +134,7 @@
{% include code/end.html %}
{% include code/start.html id="attach2" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const doc = {
"_id": "doc",
@@ -155,7 +155,7 @@
{% include code/end.html %}
{% include code/start.html id="attach2" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
const doc = {
"_id": "doc",
"title": "Legendary Hearts",
@@ -180,7 +180,7 @@
You can also inline `Blob`s/`Buffer`s:
{% include code/start.html id="attach4" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
const doc = {
"_id": "doc",
"title": "Legendary Hearts",
@@ -199,7 +199,7 @@
{% include code/end.html %}
{% include code/start.html id="attach4" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const doc = {
"_id": "doc",
@@ -219,7 +219,7 @@
{% include code/end.html %}
{% include code/start.html id="attach4" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
const doc = {
"_id": "doc",
"title": "Legendary Hearts",
@@ -243,7 +243,7 @@
The inline approach allows you to save multiple attachments to the same document in a single shot:
{% include code/start.html id="attach5" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
const doc = {
"_id": "doc",
"title": "Legendary Hearts",
@@ -276,7 +276,7 @@
{% include code/end.html %}
{% include code/start.html id="attach5" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const doc = {
"_id": "doc",
@@ -310,7 +310,7 @@
{% include code/end.html %}
{% include code/start.html id="attach5" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
const doc = {
"_id": "doc",
"title": "Legendary Hearts",
diff --git a/docs/_includes/api/sync.html b/docs/_includes/api/sync.html
index eb75ed15b7..83b8586071 100644
--- a/docs/_includes/api/sync.html
+++ b/docs/_includes/api/sync.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="Sync a database" hash="sync" %}
-{% highlight js %}
+{% highlight "js" %}
const sync = PouchDB.sync(src, target, [options])
{% endhighlight %}
@@ -8,7 +8,7 @@
In other words, this code:
-{% highlight js %}
+{% highlight "js" %}
PouchDB.replicate('mydb', 'http://localhost:5984/mydb');
PouchDB.replicate('http://localhost:5984/mydb', 'mydb');
{% endhighlight %}
@@ -16,7 +16,7 @@
is equivalent to this code:
-{% highlight js %}
+{% highlight "js" %}
PouchDB.sync('mydb', 'http://localhost:5984/mydb');
{% endhighlight %}
@@ -28,7 +28,7 @@
Replication options such as `filter` passed to sync directly will be passed to both replications. Please refer to [replicate()](api.html#replication) for documentation on those options.
#### Example Usage:
-{% highlight js %}
+{% highlight "js" %}
const sync = PouchDB.sync('mydb', 'http://localhost:5984/mydb', {
live: true,
retry: true
@@ -51,14 +51,14 @@
There is also a shorthand for syncing given existing PouchDB objects. This behaves the same as `PouchDB.sync()`:
-{% highlight js %}
+{% highlight "js" %}
db.sync(remoteDB, [options]);
{% endhighlight %}
It is also possible to combine "one-way" replication and sync for performance reasons.
When your PouchDB application starts up it could perform a one-off, one-way replication to completion and then initiate the two-way, continuous retryable sync:
-{% highlight js %}
+{% highlight "js" %}
const url = 'http://localhost:5984/mydb';
const opts = { live: true, retry: true };
@@ -78,7 +78,7 @@
Change events in `sync` have an extra property `direction` which refers to the direction the change was going. Its value will either be `push` or `pull`.
-{% highlight js %}
+{% highlight "js" %}
{ direction: 'push',
change:
{ ok: true,
diff --git a/docs/_includes/api/view_cleanup.html b/docs/_includes/api/view_cleanup.html
index 4df285312d..8ff0c66d23 100644
--- a/docs/_includes/api/view_cleanup.html
+++ b/docs/_includes/api/view_cleanup.html
@@ -1,6 +1,6 @@
{% include anchor.html edit="true" title="View cleanup" hash="view_cleanup" %}
-{% highlight js %}
+{% highlight "js" %}
db.viewCleanup([callback])
{% endhighlight %}
@@ -13,7 +13,7 @@
#### Example Usage:
{% include code/start.html id="viewcleanup" type="callback" %}
-{% highlight js %}
+{% highlight "js" %}
db.viewCleanup(function (err, result) {
if (err) { return console.log(err); }
// handle result
@@ -22,7 +22,7 @@
{% include code/end.html %}
{% include code/start.html id="viewcleanup" type="async" %}
-{% highlight js %}
+{% highlight "js" %}
try {
const result = await db.viewCleanup();
} catch (err) {
@@ -32,7 +32,7 @@
{% include code/end.html %}
{% include code/start.html id="viewcleanup" type="promise" %}
-{% highlight js %}
+{% highlight "js" %}
db.viewCleanup().then(function (result) {
// handle result
}).catch(function (err) {
@@ -42,6 +42,6 @@
{% include code/end.html %}
#### Example Response:
-{% highlight js %}
+{% highlight "js" %}
{ "ok" : "true" }
{% endhighlight %}
\ No newline at end of file
diff --git a/docs/_includes/guides_nav.html b/docs/_includes/guides_nav.html
index d37e0915e4..c4773fee1f 100644
--- a/docs/_includes/guides_nav.html
+++ b/docs/_includes/guides_nav.html
@@ -1,8 +1,8 @@
-{% assign guides = (site.guides | sort: 'index') %}
+{% assign guides = collections.guides | sort: 'index' %}
{% for guide in guides %}
- {% assign title = guide.title %}
- {% if guide.nav %}
- {% assign title = guide.nav %}
+ {% assign title = guide.data.title %}
+ {% if guide.data.nav %}
+ {% assign title = guide.data.nav %}
{% endif %}
{% include nav_item.html path=guide.url text=title %}
{% endfor %}
diff --git a/docs/_includes/post_details.html b/docs/_includes/post_details.html
index 977d0c1e77..b25c4946d1 100644
--- a/docs/_includes/post_details.html
+++ b/docs/_includes/post_details.html
@@ -1,38 +1,42 @@
-{% unless post %}
- {% assign post = page %}
-{% endunless %}
+{% if post %}
+ {% assign author = post.data.author %}
+ {% assign post_date = post.date %}
+ {% assign modified_date = post.modified_date %}
+ {% assign url = post.url %}
+{% else %}
+ {% assign post_date = page.date %}
+{% endif %}
-{% assign post_author = post.author %}
-{% assign post_gravatar = 'https://www.fillmurray.com/82/82' %}
-{% assign modified_date = '' %}
+{% assign post_author = author %}
+{% assign post_gravatar = '' %}
-{% for author in site.data.authors %}
- {% if author.name == post.author %}
- {% if author.twitter %}
- {% capture post_author %}{{ post.author }}{% endcapture %}
+{% for a in authors %}
+ {% if a.name == author %}
+ {% if a.twitter %}
+ {% capture post_author %}{{ author }}{% endcapture %}
{% endif %}
- {% if author.gravatar %}
- {% capture post_gravatar %}https://gravatar.com/avatar/{{ author.gravatar }}{% endcapture %}
+ {% if a.gravatar %}
+ {% capture post_gravatar %}https://gravatar.com/avatar/{{ a.gravatar }}{% endcapture %}
{% endif %}
{% endif %}
{% endfor %}
-{% if post.modified_date %}
- {% capture modified_date %}Updated: {{ post.modified_date | date_to_long_string }}
{% endcapture %}
+{% if modified_date %}
+ {% capture modified_date %}Updated: {{ modified_date | date_to_long_string }}
{% endcapture %}
{% endif %}