A Simple Demo 
This page demonstrates some of the capabilities of the tools provided by the KnitML Project.

The simple pattern below is written in the KnitML Expression Language (KEL), which is a natural-language syntax designed for creating and maintaining patterns. It's meant to look similar to the way a "real" pattern might look.

Pattern 'en' {
GeneralInformation {
Name: 'Simple Square'
Description: 'A simple square'
Dimensions: '4 in by 4 in'
Gauge 'stockinette' {
StitchGauge: 6 stitchesPerInch
RowGauge: 6 rowsPerInch
}
}
Supplies {
Yarns {
YarnType 'yarn-type' [weight:'worsted']
}
Needles {
NeedleType 'size-4' circular { size: 4 US }
Needle 'the-needle' [typeref:'size-4']
}
Accessories
}
Directions {
CastOn 24 sts 'long-tail'
Instruction 'stockinette-st' {
Row: k to end
Row: p to end
}
Repeat 'stockinette-st' until measures 4 in
NextRow: BindOff all sts
}
}


To produce a "real" pattern from this format, several transformations will occur. First, the Knitting Expression Language tool converts the pattern from KEL into the canonical form (XML). XML is not language rich, but makes it easier for computer programs written in all languages to interpret the pattern. Designers and knitters will not need to work with XML directly, as it serves primarily as an interchange format between software.

In its XML form, the KnitML Validation tool then processes the pattern for correctness. The tool tracks stitch counts, pattern shapes, needle types, and other constructs as it steps through the pattern's directions, simulating the actual knitting experience (without the emotion, of course!)

If the pattern validates, it is then sent onto the KnitML Pattern Renderer tool, where, based on a knitter's preferences, it is converted into a pattern that suits their needs.

All three of these tools can be used together with a KnitML command called 'convertValidateAndRender'. (In the graphical editor, you can click on the Pattern View tab at the bottom of the KEL editor with the same effect.)

Running the three tools together on our simple pattern yields this result:

Simple Square
A simple square

Stitch Gauge: 6 st/in
Row Gauge: 6 row/in

Yarn:
worsted weight

Needles:
1 circular needle size 4 US (3.5 mm)

Directions
----------
Using the long-tail method, cast on 24 stitches.
Row 1: Knit
Row 2: Purl
Repeat rows 1-2 for 4 in.
Next row: bind off all stitches


This looks a lot like the original KEL format, right? So why bother with KnitML at all?

First, you can create this pattern in Spanish simply by setting a preference.
Instrucciones
-------------
Usando el montado doble, monta 24 puntos.
Hilera 1: Todo del derecho
Hilera 2: Todo del reves
Repite hileras 1-2 hasta que la pieza mida 4 in.
Hilera siguiente: ramatar todos los puntos


You can also feel confident that there aren't typos in the pattern that would cause the work to be unknittable. For instance, if you were to change the line in the KEL pattern:
Row: k to end

to:
Row: k20


you will get an error saying that the pattern is not knittable (it's expecting 4 more stitches in this row).

You can also perform calculations on the directions given in the pattern. For instance, KnitML Gauge Transformer provides advice about altering a pattern's gauge. Here's what the pattern would look like if I wanted to knit it at 5 stitches to the inch instead of stitch:

Simple Square
A simple square

Stitch Gauge: 5 st/in
Row Gauge: 6 row/in

Yarn:
worsted weight

Needles:
1 circular needle size 4 US (3.5 mm)

Directions
----------
Using the long-tail method, cast on 20 stitches.
Row 1 [with 4 fewer st]: k 24 times
Row 2 [with 4 fewer st]: p 24 times
Repeat rows 1-2 for 4 in.
Next row [with 4 fewer st]: bind off all stitches


While the tools created by the KnitML Project were conceived together, they are by no means the only tools meant to be written to the specification. Software which exists today can be made to have import and export facilities which use KnitML with relatively little effort, allowing that software to excel at its strengths.
There are many more possibilities for tools built around the KnitML specification.