Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions examples/presentation-document/content/document.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"version": "0.1",
"blocks": [
{
"type": "heading",
"id": "chapter-1",
"level": 1,
"children": [{ "type": "text", "value": "Chapter 1: Introduction" }]
},
{
"type": "paragraph",
"id": "p-intro-1",
"children": [
{ "type": "text", "value": "This document demonstrates the advanced presentation features available in the Codex format. The presentation layer provides fine-grained control over typography, layout, and print output." }
]
},
{
"type": "paragraph",
"id": "p-intro-2",
"children": [
{ "type": "text", "value": "The separation of content from presentation means that the same semantic document can be rendered in multiple ways—as a printed book, a responsive web page, or an accessible screen reader output—while maintaining consistent meaning." }
]
},
{
"type": "heading",
"id": "section-1-1",
"level": 2,
"children": [{ "type": "text", "value": "1.1 Typography Features" }]
},
{
"type": "paragraph",
"id": "p-typo-1",
"children": [
{ "type": "text", "value": "Professional typography includes hyphenation, widow and orphan control, and baseline grid alignment. These features ensure that text flows naturally and pages maintain visual consistency." }
]
},
{
"type": "paragraph",
"id": "p-typo-2",
"children": [
{ "type": "text", "value": "OpenType features like ligatures, small caps, and old-style numerals can be enabled per style. Variable fonts allow fine control over weight, width, and other axes." }
]
},
{
"type": "figure",
"id": "fig-layout",
"children": [
{
"type": "image",
"src": "assets/images/layout-example.png",
"alt": "Diagram showing multi-column layout with flow regions"
},
{
"type": "figcaption",
"children": [{ "type": "text", "value": "Figure 1: Multi-column layout with flow regions" }]
}
],
"numbering": "auto"
},
{
"type": "heading",
"id": "section-1-2",
"level": 2,
"children": [{ "type": "text", "value": "1.2 Page Layout" }]
},
{
"type": "paragraph",
"id": "p-layout-1",
"children": [
{ "type": "text", "value": "The presentation extension supports both multi-column and grid layouts. Text can flow through defined regions across multiple pages, enabling complex magazine-style layouts." }
]
},
{
"type": "paragraph",
"id": "p-layout-2",
"children": [
{ "type": "text", "value": "Master pages define reusable templates with margins, headers, footers, and background elements. Rules can automatically apply different masters to chapter openings, full-bleed pages, and default pages." }
]
},
{
"type": "heading",
"id": "chapter-2",
"level": 1,
"children": [{ "type": "text", "value": "Chapter 2: Print Features" }]
},
{
"type": "paragraph",
"id": "p-print-1",
"children": [
{ "type": "text", "value": "For professional printing, the presentation extension supports bleeds, trim marks, registration marks, and spot colors. Documents can be configured for PDF/X compliance." }
]
},
{
"type": "paragraph",
"id": "p-print-2",
"children": [
{ "type": "text", "value": "Running headers and footers can include dynamic content like chapter titles, section names, page numbers, and total page counts. Different templates can be applied to odd and even pages for book-style facing layouts." }
]
},
{
"type": "table",
"id": "table-features",
"children": [
{
"type": "tableRow",
"header": true,
"children": [
{
"type": "tableCell",
"children": [{ "type": "paragraph", "children": [{ "type": "text", "value": "Feature" }] }]
},
{
"type": "tableCell",
"children": [{ "type": "paragraph", "children": [{ "type": "text", "value": "Description" }] }]
}
]
},
{
"type": "tableRow",
"children": [
{
"type": "tableCell",
"children": [{ "type": "paragraph", "children": [{ "type": "text", "value": "Master Pages" }] }]
},
{
"type": "tableCell",
"children": [{ "type": "paragraph", "children": [{ "type": "text", "value": "Reusable page templates with margins and headers" }] }]
}
]
},
{
"type": "tableRow",
"children": [
{
"type": "tableCell",
"children": [{ "type": "paragraph", "children": [{ "type": "text", "value": "Hyphenation" }] }]
},
{
"type": "tableCell",
"children": [{ "type": "paragraph", "children": [{ "type": "text", "value": "Language-aware word breaking" }] }]
}
]
},
{
"type": "tableRow",
"children": [
{
"type": "tableCell",
"children": [{ "type": "paragraph", "children": [{ "type": "text", "value": "Line Numbering" }] }]
},
{
"type": "tableCell",
"children": [{ "type": "paragraph", "children": [{ "type": "text", "value": "Margin line numbers for legal/manuscript documents" }] }]
}
]
}
]
}
]
}
29 changes: 29 additions & 0 deletions examples/presentation-document/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"codex": "0.1",
"id": "pending",
"state": "draft",
"created": "2025-01-29T10:00:00Z",
"modified": "2025-01-29T10:00:00Z",
"content": {
"path": "content/document.json",
"hash": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"presentation": [
{
"type": "paginated",
"path": "presentation/paginated.json",
"hash": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"default": true
}
],
"metadata": {
"dublinCore": "metadata/dublin-core.json"
},
"extensions": [
{
"id": "codex.presentation",
"version": "0.1",
"required": false
}
]
}
13 changes: 13 additions & 0 deletions examples/presentation-document/metadata/dublin-core.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "1.1",
"terms": {
"title": "Presentation Extension Example",
"creator": "Codex Specification Team",
"subject": ["Document Format", "Presentation", "Typography"],
"description": "An example document demonstrating the Presentation Extension features including master pages, typography, multi-column layout, and running headers/footers.",
"date": "2025-01-29",
"type": "Text",
"format": "application/vnd.codex+zip",
"language": "en"
}
}
184 changes: 184 additions & 0 deletions examples/presentation-document/presentation/paginated.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{
"version": "0.1",
"type": "paginated",
"defaults": {
"pageSize": { "width": "6in", "height": "9in" },
"margins": { "top": "0.75in", "outside": "0.75in", "bottom": "0.875in", "inside": "1in" }
},
"masterPages": {
"default": {
"margins": { "top": "0.75in", "right": "0.75in", "bottom": "0.875in", "left": "1in" },
"header": { "height": "0.5in" },
"footer": { "height": "0.5in" }
},
"chapter-start": {
"basedOn": "default",
"margins": { "top": "2in" },
"header": null
},
"full-bleed": {
"margins": { "top": "0", "right": "0", "bottom": "0", "left": "0" }
}
},
"masterRules": [
{ "match": { "first": true }, "master": "chapter-start" },
{ "match": { "contains": "full-bleed-image" }, "master": "full-bleed" },
{ "match": { "default": true }, "master": "default" }
],
"pageTemplate": {
"odd": {
"header": {
"height": "0.4in",
"content": {
"right": { "variable": "section-title" }
}
},
"footer": {
"height": "0.4in",
"content": {
"right": { "text": "{pageNumber}" }
}
}
},
"even": {
"header": {
"height": "0.4in",
"content": {
"left": { "variable": "chapter-title" }
}
},
"footer": {
"height": "0.4in",
"content": {
"left": { "text": "{pageNumber}" }
}
}
}
},
"layout": {
"type": "columns",
"columns": 1,
"gap": "0.25in"
},
"typography": {
"hyphenation": {
"enabled": true,
"language": "en-US",
"minWordLength": 6,
"minBefore": 3,
"minAfter": 2,
"maxConsecutive": 2
},
"widows": 2,
"orphans": 2,
"baselineGrid": {
"enabled": true,
"lineHeight": "14pt",
"offset": "0pt"
},
"lineNumbering": {
"enabled": false
}
},
"print": {
"bleed": {
"top": "0.125in",
"right": "0.125in",
"bottom": "0.125in",
"left": "0.125in"
},
"trim": {
"width": "6in",
"height": "9in"
},
"cropMarks": true,
"registrationMarks": true,
"colorBars": false
},
"tableOfContents": {
"title": "Contents",
"levels": [1, 2],
"pageNumbers": true,
"leaders": "dots"
},
"footnotes": {
"numbering": "1",
"position": "page-bottom",
"separator": {
"width": "2in",
"style": "solid",
"margin": "0.5em"
}
},
"styles": {
"body": {
"fontFamily": "Source Serif Pro",
"fontSize": "11pt",
"lineHeight": 1.4,
"textAlign": "justify",
"fontFeatureSettings": {
"liga": true,
"kern": true,
"onum": true
}
},
"heading1": {
"fontFamily": "Source Sans Pro",
"fontSize": "24pt",
"fontWeight": 700,
"lineHeight": 1.2,
"marginTop": "0",
"marginBottom": "18pt",
"pageBreakBefore": "always"
},
"heading2": {
"fontFamily": "Source Sans Pro",
"fontSize": "16pt",
"fontWeight": 600,
"lineHeight": 1.3,
"marginTop": "24pt",
"marginBottom": "12pt"
},
"chapter-first-para": {
"extends": "body",
"dropCap": {
"lines": 3,
"fontFamily": "inherit",
"fontWeight": "bold",
"marginRight": "0.1em"
}
},
"figure": {
"marginTop": "1em",
"marginBottom": "1em",
"textAlign": "center"
},
"figcaption": {
"fontFamily": "Source Sans Pro",
"fontSize": "9pt",
"fontStyle": "italic",
"marginTop": "0.5em"
},
"table": {
"fontSize": "10pt",
"marginTop": "1em",
"marginBottom": "1em"
},
"tableCell": {
"paddingTop": "4pt",
"paddingRight": "8pt",
"paddingBottom": "4pt",
"paddingLeft": "8pt",
"borderWidth": "0.5pt",
"borderStyle": "solid",
"borderColor": "#cccccc"
},
"toc1": {
"fontWeight": "bold",
"marginTop": "1em"
},
"toc2": {
"marginLeft": "1em"
}
}
}
Loading