alonso.torres 894408ff7b ✨ Add CJK text attributes and language profiles to the data model
Texts get the attributes of CJK layout: the language of each paragraph (a
BCP 47 tag), the writing mode and orientation, readings (ruby, pinyin and
zhuyin), emphasis marks, warichu, tate-chu-yoko, line breaking rules and
distributed alignment. `cjk-layout` holds their values and defaults and
tells which language family a tag belongs to.

Files keep a language profile in their options: the language new text
layers take when the user has not picked one. Profiles keep their own
default, and new files start with it. A new change type sets the file
profile, and the `cjk-support` feature gates the whole work.

Range styling joins spans left with the same style, since tate-chu-yoko
and readings work per span.

AI-assisted-by: claude-opus-5-5
2026-11-16 22:37:35 +01:00
..
2025-05-20 13:05:52 +02:00
2025-09-21 22:15:27 +02:00
2026-01-22 13:55:41 +01:00
2026-09-22 10:22:31 +02:00
2026-11-06 08:49:30 +01:00
2026-10-07 10:41:29 +02:00

Penpot Library

A library that exposes a limited set of Penpot's features for programmatic use. Currently, it provides methods to build Penpot files in memory and export them as .penpot files (ZIP archives containing all the necessary data to import them into a Penpot application).

User Guide

How to install

pnpm add @penpot/library

Example of use

import * as penpot from "@penpot/library";
import { createWriteStream } from 'fs';
import { Writable } from "stream";

const context = penpot.createBuildContext();


context.addFile({name: "Test File 1"});
context.addPage({name: "Foo Page"});

context.addBoard({
  name: "Foo Board",
  x: 0,
  y: 0,
  width: 500,
  height: 300,
});

context.closeBoard();
context.closeFile();

// Create a file stream to write the zip to
const output = createWriteStream('sample-stream.zip');

// Wrap Node's stream in a WHATWG WritableStream
const writable = Writable.toWeb(output);
await penpot.exportStream(context, writable);

Developer Guide

How to publish

Build the library:

./scripts/build

Login on npm:

npm login

Publish on npm:

npm publish --access public

License

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Copyright (c) KALEIDOS SUBSIDIARY SL