Releases: danburzo/percollate
v4.0.0
Breaking changes
This release changes how Percollate interprets operands (See #150): when no operand is provided, an implicit -
(stdin
) is assumed. This makes it nicer to pipe data into percollate from an external tool.
Although not part of the public API, Percollate's logging has largely shifted from stdout
to stderr
, to allow html
and md
to be piped to an external tool.
New features
v3.0.0
⚠️ Breaking changes
Node 14 required
Node.js 14.17 or later is required to run Percollate 3.0.0. Users on Node.js 12.x can continue using Percollate 2.x by installing it with:
npm install -g percollate@2
Programmatic API breaking changes
Note: The programmatic API is not currently part of the public, documented API.
fetchContent()
, which used to return the page content as a string decoded to 'utf-8', will now return an object of the shape { buffer: ArrayBuffer, contentType: string? }
. Consequently, calls to pdf()
, epub()
and html()
will return on the .originalContent
this new structure as well. See Programmatic API migration for details below.
New features
Experimental Firefox support for PDF rendering
Added experimental Firefox Nightly support for rendering PDFs, via the percollate pdf --browser=firefox
option. To fetch Firefox Nightly, perform the following installation steps:
# fetches Chrome
npm install -g percollate
# fetches Firefox Nightly
PUPPETEER_PRODUCT=firefox npm install -g percollate
Bug fixes
Better default styles for code blocks with the tab-size: 2
CSS property.
Migration
Programmatic API migration
Note: The programmatic API is not currently part of the public, documented API.
In general, an ArrayBuffer
can be converted to a String with the TextDecoder
class available in Node.js. In case the content uses a different encoding than the default utf-8
, you can use the whatwg-mimetype
and html-encoding-sniffer
packages (on which jsdom
already depends) to obtain the content's encoding:
import { TextDecoder } from 'node:util';
import htmlEncodingSniffer from 'html-encoding-sniffer';
import MimeType from 'whatwg-mimetype';
const { buffer, contentType } = await fetchContent(...);
const encoding = contentType
? new MimeType(contentType).parameters.get('charset')
: undefined;
const str = new TextDecoder(
htmlEncodingSniffer(buffer, {
transportLayerEncodingLabel: encoding
})
).decode(buffer);
v2.2.2
v2.2.1
v2.2.0
v2.1.0
v2.0.0
- It requires Node.js 12.20.0, Node.js 14.10.0, or Node 16.0 or later to run.
- It can no longer be
require()
d into your project. You must eitherimport
it statically, orimport()
it dynamically.
You can continue to use Percollate 1.x on Node.js 10, and as a CommonJS dependency:
npm install -g percollate@1
(Please note that while 1.x version is perfectly usable, it will no longer receive updates going forward.)
Additionally, the default Git branch has been renamed to main
.
v2.0.0-alpha.0
2.0.0-alpha.0
v1.2.6
This release includes some fixes to make articles on acoup.blog work better in epub
, thanks @Akuukis!
Bug fixes
- When fetching images for bundling in the EPUB, include URLs that use query parameters (e.g.
image.png?w=1024
) - When an
<img>
or<source>
element contains asrc
attribute and asrcset
attribute, discard thesrcset
to keep the EPUB size down. (Previously, several versions of an image would have be bundled in the EPUB, to the detriment of disk space.)