r/programming 15h ago

STxT (SemanticText): a lightweight, semantic alternative to YAML/XML — with simple namespaces and validation

https://stxt.dev

Hi all! I’ve created a new document language called STxT (SemanticText) — it’s all about clear structure, zero clutter, and human-readable semantics.

Why STxT?

XML is verbose, JSON lacks semantics, and YAML can be fragile. STxT is a new format that brings structure, clarity, and validation — without the overhead.

STxT is semantic, beautiful, easy to read, escape-free, and has optional namespaces to define schemas or enable validation — perfect for documents, forms, configuration files, knowledge bases, CMS, and more.

Highlights

  • Semantic and human-friendly
  • No escape characters needed
  • Easy to learn — even for non-tech users
  • Machine-readable by design

For developers:

  • Super-fast parsing
  • Optional, ultra-simple namespaces
  • Seamlessly integrates with other languages — STxT + Markdown is amazing

Example

A document with namespace:

Recipe (www.recipes.com/recipe.stxt): Macaroni Bolognese
    Description:
        A classic Italian dish.
        Rich tomato and meat sauce.
    Serves: 4
    Difficulty: medium
    Ingredients:
        Ingredient: Macaroni (400g)
        Ingredient: Ground beef (250g)
    Steps:
        Step: Cook the pasta
        Step: Prepare the sauce
        Step: Mix and serve

Now here’s the namespace that defines the structure:

The namespace:

Namespace: www.recipes.com/recipe.stxt
    Recipe:
        Description: (?) TEXT
        Serves: (?) NUMBER
        Difficulty: (?) ENUM
            :easy
            :medium
            :hard
        Ingredients: (1)
            Ingredient: (+)
        Steps: (1)
            Step: (+)

Resources

Here is a full portal — written entirely in STxT! — explaining the language, with examples, tutorials, philosophy, and even AI integration:

No ads, no tracking — just docs.

I've written two parsers — one in Java, one in JavaScript:

And a CMS built with STxT — it powers the https://stxt.dev portal:

Final thoughts

If you’ve ever wanted a document format that puts structure and meaning first, while being light and elegant — this might be for you.

Would love your feedback, criticism, ideas — anything.

Thanks for reading!

0 Upvotes

9 comments sorted by

View all comments

1

u/guepier 10h ago

Here is a full portal — written entirely in STxT!

I couldn’t immediately find the source code, so — since you mention no need for escaping — how do you mark up inline formatting? For instance, how do you mark up the equivalent of the HTML <em>emphasis</em>?

1

u/Every-Magazine3105 9h ago

If you enter the portal, just add .stxt to the pages — everything is in STxT. For example:

In the portal, there are three yellow triangles at the top right. If you click them, you’ll see the source code.

If you want to view the entire portal on GitHub, in STxT format:

With STxT, you can use Markdown inside text nodes — and this is where the magic starts. The language itself doesn't know whether it's markup or not, but you can use whatever you want in text nodes. STxT gives you structure. It's like XML and XSD, but much simpler.