diff --git a/README.md b/README.md index 0245a50..c9e5418 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ Parse and convert reMarkable tablet `.rm` files (version 6, software ≥ 3). ## Installation ```bash -npm install notable +npm install @robin.berjon/notable ``` Or globally to use the CLI: ```bash -npm install -g notable +npm install -g @robin.berjon/notable ``` ## CLI Usage @@ -86,7 +86,7 @@ import { readBlocks, writeBlocks, readTree, simpleTextDocument, rmToMarkdown, rmToSvg, rmToPdf, rmsToPdf, -} from 'notable'; +} from '@robin.berjon/notable'; ``` ### Converters @@ -95,7 +95,7 @@ The CLI's converters are part of the library: ```js import { readFileSync, writeFileSync } from 'node:fs'; -import { rmToMarkdown, rmToSvg, rmsToPdf } from 'notable'; +import { rmToMarkdown, rmToSvg, rmsToPdf } from '@robin.berjon/notable'; const page = readFileSync('page.rm'); const markdown = rmToMarkdown(page); // string @@ -114,7 +114,7 @@ data once and export it several ways. ```js import { readFileSync } from 'node:fs'; -import { readBlocks } from 'notable'; +import { readBlocks } from '@robin.berjon/notable'; const data = readFileSync('note.rm'); for (const block of readBlocks(data)) { @@ -127,7 +127,7 @@ for (const block of readBlocks(data)) { ### Writing blocks ```js -import { writeBlocks } from 'notable'; +import { writeBlocks } from '@robin.berjon/notable'; const buf = writeBlocks(blocks, { version: '3.2.2' }); // buf is a Buffer ready to write to a .rm file @@ -138,7 +138,7 @@ The `options` object supports a `version` string to control which format feature ### Reading the scene tree ```js -import { readTree } from 'notable'; +import { readTree } from '@robin.berjon/notable'; const tree = readTree(data); // tree.root — root Group containing layers @@ -149,7 +149,7 @@ const tree = readTree(data); ### Walking strokes ```js -import { Line } from 'notable'; +import { Line } from '@robin.berjon/notable'; for (const item of tree.walk()) { if (item instanceof Line) { @@ -161,7 +161,7 @@ for (const item of tree.walk()) { ### Creating a text document ```js -import { simpleTextDocument, writeBlocks } from 'notable'; +import { simpleTextDocument, writeBlocks } from '@robin.berjon/notable'; const buf = writeBlocks(simpleTextDocument('Hello reMarkable!')); ``` @@ -187,7 +187,7 @@ const buf = writeBlocks(simpleTextDocument('Hello reMarkable!')); ### Scene items ```js -import { PenColor, Pen, ParagraphStyle } from 'notable'; +import { PenColor, Pen, ParagraphStyle } from '@robin.berjon/notable'; // PenColor values: BLACK(0), GRAY(1), WHITE(2), YELLOW(3), GREEN(4), // PINK(5), BLUE(6), RED(7), GRAY_OVERLAP(8), HIGHLIGHT(9), ... @@ -201,7 +201,7 @@ import { PenColor, Pen, ParagraphStyle } from 'notable'; ### Text extraction ```js -import { readTree, TextDocument } from 'notable'; +import { readTree, TextDocument } from '@robin.berjon/notable'; const tree = readTree(data); if (tree.rootText) { @@ -217,7 +217,7 @@ if (tree.rootText) { `CrdtSequence` is an ordered sequence backed by a topological sort of CRDT items: ```js -import { CrdtSequence, CrdtSequenceItem, CrdtId } from 'notable'; +import { CrdtSequence, CrdtSequenceItem, CrdtId } from '@robin.berjon/notable'; const seq = new CrdtSequence([ new CrdtSequenceItem(new CrdtId(1, 1), new CrdtId(0, 0), new CrdtId(0, 0), 0, 'A'), diff --git a/bin/notable.js b/bin/notable.js index 3cc0272..8817154 100755 --- a/bin/notable.js +++ b/bin/notable.js @@ -7,12 +7,14 @@ import { rmToMarkdown } from '../lib/exporters/markdown.js'; import { rmToSvg } from '../lib/exporters/svg.js'; import { rmsToPdf } from '../lib/exporters/pdf.js'; +const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url))); + const program = new Command(); program .name('notable') .description('Convert to/from reMarkable v6 .rm files.\n\nAvailable FORMATs: rm, markdown, svg, pdf, blocks, blocks-data') - .version('0.1.0') + .version(version) .option('-v, --verbose', 'Increase verbosity (repeat for more)', (_, prev) => prev + 1, 0) .option('-f, --from ', 'Format to convert from (default: guess from filename)') .option('-t, --to ', 'Format to convert to (default: guess from filename)') diff --git a/package.json b/package.json index d4513a9..c7a0ab3 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "notable", + "name": "@robin.berjon/notable", "type": "module", "version": "1.0.0", "description": "Parse and convert reMarkable .rm files",