From 78935ec83ce8f5da12c21421bfa7f489329e5b57 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 4 Aug 2024 19:25:21 -0400 Subject: [PATCH] Make node-format.md part of the docs This makes useful information more easily available, and it also serves to validate the markdown. --- demos/node-editor/node-editor.gresource.xml | 2 +- docs/reference/gtk/gtk4.toml.in | 1 + .../reference/gtk}/node-format.md | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 10 deletions(-) rename {demos/node-editor => docs/reference/gtk}/node-format.md (98%) diff --git a/demos/node-editor/node-editor.gresource.xml b/demos/node-editor/node-editor.gresource.xml index b32e88e661..d65ea4c0d7 100644 --- a/demos/node-editor/node-editor.gresource.xml +++ b/demos/node-editor/node-editor.gresource.xml @@ -3,7 +3,7 @@ node-editor-window.ui help-window.ui - node-format.md + ../../docs/reference/gtk/node-format.md data/scalable/apps/org.gtk.gtk4.NodeEditor.svg diff --git a/docs/reference/gtk/gtk4.toml.in b/docs/reference/gtk/gtk4.toml.in index 0d9f3b9d08..8e2d65638c 100644 --- a/docs/reference/gtk/gtk4.toml.in +++ b/docs/reference/gtk/gtk4.toml.in @@ -85,6 +85,7 @@ content_files = [ "x11.md", "tools.md", "visual_index.md", + "node-format.md", ] content_images = [ "../images/favicon.svg", diff --git a/demos/node-editor/node-format.md b/docs/reference/gtk/node-format.md similarity index 98% rename from demos/node-editor/node-format.md rename to docs/reference/gtk/node-format.md index c04b9a91a4..4045956fa0 100644 --- a/demos/node-editor/node-format.md +++ b/docs/reference/gtk/node-format.md @@ -1,14 +1,15 @@ -# The Node file format +Title: The Node file format GSK render nodes can be serialized and deserialized using APIs such as `gsk_render_node_serialize()` and `gsk_render_node_deserialize()`. The intended use for this is development - primarily the development of GTK - by allowing things such as creating testsuites and benchmarks, exchanging nodes in bug reports. GTK includes the `gtk4-node-editor` application for creating such test files. The format is a text format that follows the [CSS syntax rules](https://drafts.csswg.org/css-syntax-3/). In particular, this means that every array of bytes will produce a render node when parsed, as there is a defined error recovery method. For more details on error handling, please refer to the documentation of the parsing APIs. The grammar of a node text representation using [the CSS value definition syntax](https://drafts.csswg.org/css-values-3/#value-defs) looks like this: -**document**: `<@-rule>\*\*` -**@-rule**: @cicp "name" { * } -**node**: container [ "name" ] { } | ` [ "name" ] { * }` | "name" -**property**: `: | ;` + + document: <@-rule>** + @-rule: @cicp "name" { * } + node: container [ "name" ] { } | [ "name" ] { * } | "name" + property: : | ; Each node has its own `` and supports a custom set of properties, each with their own `` and syntax. The following paragraphs document each of the nodes and their properties. @@ -31,13 +32,13 @@ Just like nodes, textures can be referenced by name. When defining a named textu Color states are represented either by an ident (for builtin ones) or a string (for custom ones): -**color-state**: ` | ` + color-state: | -Custom color states can be defined at the beginning of the document, with an `@cicp` rule. +Custom color states can be defined at the beginning of the document, with an @‌cicp rule. -The format for `@cicp` rules is +The format for @‌cicp rules is - @cicp "name" { + @‌cicp "name" { ... }