v0.4.12
Added renderFromStorage
method
Now, when rendering a document encoded as storage, you can usa this shorthand function.
Before:
render(
registry,
await documentToParsed(
registry,
makeJDDContext(ctx),
documentContainerFromStorage(
page.get("content") as RawJDDocument
)
),
makeJDDContext(ctx)
)
You can just call
renderFromStorage(
registry,
page.get("content") as RawJDDocument,
makeJDDContext(ctx),
);
v0.4.13
fix a problem with getArgumentPath
not working properly with Table header args
v0.4.14
The insert_nbsp
function is more fault-tolerant now - it will not throw an error if given a null value instead of a string
v0.4.15
The documentToParsed
now will not throw an error when encountering unknown component. The unknown component will now be skipped and a warning printed to the console. An optional handle_unknown_component
argument lets you customize this behavior and throw an error if you want.
v0.4.16
Add a SingleReference argument type
v0.4.17
Added support for adding hardcoded soft hyphens to work around Chrome’s lack of hyphenation dictionary for Polish language
It is a breaking change, as now calling render_markdown
requires you to specify the language of the text within.
v0.4.18
Only apply soft hyphens to text parts of rendered markdown, to avoid mangling link URLs
v0.4.19
Change the API of the renderHTML
function. It now takes a classes
argument that is a list of strings and you have to put those classes into the main html element of the component in order for some advanced JDD editor features like scrollto to work.
v0.4.20
Add jdd-component
class to each rendered component using the api from v.0.4.19. This is used to create a “click component to reveal its params” feature in the JDD editor
v0.4.21
Add renderEarlyAssetsFromStorage
- an easier alternative to renderEarlyAssets
where you don’t have to parse the JDD document that comes from storage. So rendering early assets is now:
renderEarlyAssetsFromStorage(
registry,
(entry.get("content") as RawJDDocument) || [],
makeJDDContext(ctx)
)
v0.4.22
List
argument type is now more tolerant of empty values
v0.4.23
Component.storageToParsed
now does not throw an error when given values that don’t correspond to an existing argument
v0.4.24, v0.4.25
JDD now uses more serious and boring default images for the image
argument
v0.5.0
This is a breaking change. The toHTML
method of the Component
class now takes a single object argument, instead of four arguments. This makes the function declaration more concise, as unused args can be simply skipped instead of aliased as _
, __
, etc.
Before:
async toHTML(
{
title,
content,
images,
}: ExtractStructuredComponentArgumentsParsed<typeof component_arguments>,
{ render_markdown, render_image }: JDDContext
): Promise<Readable> {
After:
async toHTML({
args: { title, content, images },
jdd_context: { render_markdown, render_image },
}: ComponentToHTMLArgs<typeof component_arguments>): Promise<Readable> {
v0.5.1
Updates tempstream dependency
v0.5.2
Fix an error when encountering unknown arguments while parsing a component. Now they are just ignored.
v0.5.3
Add possibility to override the entirety of Structured component arguments’ exampleValues
v0.5.4
Add .getTitle method to the Component class
v0.5.5
Enum Argument now respects customized example values
#v0.6.0
- Add option to generate headings from each component, to compose a TOC for a document
- Change the API. Before:
import {renderFromStorage, rawJDDocument, makeJDDContext} from "@sealcode/jdd";
renderFromStorage(
registry,
page.get("content") as RawJDDocument,
makeJDDContext(ctx),
);
Now:
const jdd = JDD.fromStorage(
registry,
jdd_context,
(article.get("content") || []) as RawJDDocument
);
jdd.render();
The jdd
object can then be re-used to for example render the early assets.
v0.6.3
Basic support for css clumps (see sealgen changelog in the near future)
v0.6.4
Properly handle example values in table argument
Use cache in single-reference argument
v0.6.5
Update tempstream