Skip to content

Commit b44af56

Browse files
authored
Merge pull request #69 from puzzmo-com/nested-tags
Adds nested tag support and small caps support
2 parents 17f52ca + 5b98bd3 commit b44af56

7 files changed

Lines changed: 572 additions & 513 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
This isn't a comprehensive doc because to our knowledge there are no OSS consumers of this lib, but for posterities sake here are the breaking changes:
22

3+
### 13.0.0
4+
5+
- All formatting types (bold, italics, strike, underscore, subscript, superscript, link, color) now have a required `children` field containing parsed inner components. This enables nested markup like `{*{/bold italic/}*}` or `{*bold {/and italic/} text*}`.
6+
7+
- The `text` field (index 1) still contains the raw content string for backwards compatibility. It has been marked as deprecated though.
8+
9+
- The markup has switched from some regexes to a real parser.
10+
11+
312
### 12.3.0
413

514
- Adds a CLI, see the README for examples of usage

CLAUDE.md

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,51 @@ yarn dev # Starts on http://localhost:5173
6969

7070
## XD Format Syntax
7171

72-
Basic structure:
72+
Real example from `tests/output/alpha-bits.xd` (trimmed):
7373

7474
```
75-
Title: Example Puzzle
76-
Author: Jane Doe
75+
## Metadata
7776
78-
[grid definition with letters/blanks]
77+
title: Alpha-Bits
78+
author: Drew Hodson
79+
copyright: © 2021
80+
description: N/A
7981
80-
Across
81-
1. First clue
82-
2. Second clue
82+
## Grid
8383
84-
Down
85-
1. First down clue
84+
AHAB..CUD.SERIF
85+
MADAM.ANY.ABODE
86+
PLANE.DIE.NOTON
87+
....TODO.EGO...
88+
89+
## Clues
90+
91+
A1. Captain of the Pequod ~ AHAB
92+
A5. Food for second chance chewing ~ CUD
93+
A8. Font feature ~ SERIF
94+
...
95+
D1. Pc. of concert gear ~ AMP
96+
D2. Conceal ~ HIDE
97+
D3. AAA's counterpart across the pond ~ RAC
98+
...
99+
100+
## Notes
101+
102+
## Design
103+
104+
<style>O { background: circle }</style>
105+
106+
O..O##O.O#.O..O
107+
.....#...#.....
108+
...
86109
```
87110

111+
Sections are separated by `## Headers`. Grid uses `.` for black squares, letters for fills. Clues use `A`/`D` prefixes with `~` separating clue from answer.
112+
88113
Special features:
89114

90-
- Rebus: `(OK)` in grid
91-
- Markup: `{/italic/}`, `{*bold*}`, `{&link|url&}`, `{!image|alt!}`
92-
- Metadata in curly braces: `{Notes: Some notes}`
115+
- Markup: `{/italic/}`, `{*bold*}`, `{&link|url&}`, `{!image|alt!}` and more
116+
93117

94118
## Development Tips
95119

@@ -98,3 +122,4 @@ Special features:
98122
- The website automatically rebuilds when packages change in dev mode
99123
- Check existing test fixtures in `tests/` directories for format examples
100124
- When writing tests prefer using fixtures instead of writing objects yourself which conform to the interface shapes
125+
- **Round-trip fidelity is a hard problem in this project.** The pipeline xd → AST → xd must produce the same document. New features should always include a full pipeline round-trip test to verify the output matches the original input

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4441,7 +4441,9 @@ The key is that a line has to start with `<!--` and eventually the same or anoth
44414441

44424442
#### Markup in Clues
44434443

4444-
The [xd spec](https://github.com/century-arcade/xd/blob/master/doc/xd-format.md#clues-section-3) defines markup inside a clue as roughly being "markdown sigil's wrapped in `{` and `}`". We support this format, and will always fill out a key of `markup` which is an array of components. We also add support for links via this syntax: `{@text|url@}`.
4444+
The [xd spec](https://github.com/century-arcade/xd/blob/master/doc/xd-format.md#clues-section-3) defines markup inside a clue as roughly being "markdown sigil's wrapped in `{` and `}`".
4445+
4446+
We support this format, and will always fill out a key of `markup` which is an array of components. We also support nested tags.
44454447

44464448
<!-- prettier-ignore -->
44474449
```md
@@ -4478,8 +4480,9 @@ Which will add the optional `"bodyMD"` to the clue:
44784480
- Inline colours: `{#`<kbd>text</kbd>`|`<kbd>hex colour light</kbd>|<kbd>hex colour dark</kbd>`#}`
44794481
- Subscript `{~`<kbd>words</kbd>`~}`
44804482
- Superscript `{^`<kbd>words</kbd>`^}`
4483+
- Small caps: `{=`<kbd>words</kbd>`=}`
44814484

4482-
There is an exported `xdMarkupProcessor` which you can use to do your own markup processing if needed.
4485+
There is an exported `xdMarkupProcessor` and `xdMarkupSerializer` which you can use to do your own markup processing if needed.
44834486

44844487
#### Split character
44854488

@@ -4503,7 +4506,7 @@ We want to highlight that 'Comments', 'Split Characters', 'Schrödinger clues' a
45034506

45044507
### Aesthetics
45054508

4506-
The xd spec is built for isplaying a large corpus of finished Crosswords, we use it for creation of new ones. This means we have a few extensions to the format to make it easier to write puzzles.
4509+
The xd spec is built for displaying a large corpus of finished Crosswords, we use it for creation of new ones. This means we have a few extensions to the format to make it easier to write puzzles.
45074510

45084511
- `## Design`
45094512

0 commit comments

Comments
 (0)