Here you will find a detailed guide for the handling and automation of projects by the extension (.bw). If you want to contribute the tool itself, consult this documentation.
Before continuing, read about the application flow to understand a little better how betterwrite handles the extension, among other correlations.
To access the extension data is very simple:
- Unzip;
- Read data.json;
- Parse;
- Access your target data.
If you want to use any json or tracing viewers, make sure to remove images (because they are base64 data) for a better experience.
Mimetype is
application/bw+zip
All types are centered in packages/better-write-types
. If you want to access or change something specific, check the package.
Reactive settings will always be in editor.*
, and its reference is here.
Primary content is available at project.chapters[].entities[]
where each entity has the values in raw and other extra information. Every block of information is treated as entity and handled by the index of its position in the list:
export type ContextState = {
id: string
title: string
entities: Array<Entity>
createdAt: string
updatedAt: string
}
export type Entity = {
type: EntityType // paragraph | image | line-break | checkbox | ...
raw: string
createdAt?: string
updatedAt?: string
visual: EntityVisual // css background override (characters system, select...)
external?: EntityExternal // for custom data (checkbox value, image size...)
}
All content can be accessed from project.annotations[]
. Because the annotations use a tertiary editor (Milkdown), the way to access the specific contents are in the documentation of the editor itself.
Until this moment, it is not possible to access the void.