Boson.WebKit 1.2.0

dotnet tool install --global Boson.WebKit --version 1.2.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Boson.WebKit --version 1.2.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Boson.WebKit&version=1.2.0
                    
nuke :add-package Boson.WebKit --version 1.2.0
                    

WebKit

WebKit is a hybrid Markdown + HTML site engine written in C#.
It transforms simple .md pages into clean, responsive websites β€” with built-in layouts, dark/light mode, and expression support.


✨ Features

  • Responsive layout πŸ“±
  • Dark πŸŒ™ + Light β˜€οΈ mode
  • Hybrid Markdown + HTML syntax
  • Simple expressions with Getters + Setters
  • Configurable via webkit.json

πŸ“¦ Installation

Using .NET Tool

dotnet tool install -g Boson.WebKit

⚑ Quick Start

webkit init -n MySite
cd MySite
webkit build
webkit serve

Open http://localhost:3000 πŸŽ‰


βš™οΈ Configuration

webkit.json

{
  "Properties": {
    "Name": "MySite",
    "Author": "CodingBoson"
  }
}

Access with expressions:

# Welcome to {{ .Name }} by {{ .Author }}

πŸ“‚ Project Structure

MySite/
 β”œβ”€ build/                 # Generated output
 β”œβ”€ Resources/             # All resources live here
 β”‚   β”œβ”€ Pages/             # Markdown + hybrid HTML pages
 β”‚   β”œβ”€ Shared/            # Reusable components
 β”‚   β”œβ”€ Static/            # CSS, JS, images
 β”‚   └─ Layout.html        # Global layout
 β”œβ”€ .gitignore
 β”œβ”€ README.md
 └─ webkit.json            # Site config

πŸ›  Commands

webkit init <Name>     # Create new site
webkit build           # Build static site
webkit serve           # Run local dev server
webkit clean           # Clear build output

Layout

The Layout.html in Resources/ defines the global wrapper for your pages.
Every page gets rendered inside this layout.

Example:

<!DOCTYPE html>
<html>
<head>
  <title>{{ .Title }}</title>
  <link rel="stylesheet" href="/webkit.css">
</head>
<body>
  {{ .NavBar }}
  <main>
    {{ .Content }}
  </main>
  <footer>
    <p>Β© {{ .Name }} by {{ .Author }}</p>
  </footer>
</body>
</html>

Shared Components

In WebKit, shared components are just resources inside Resources/Shared/.

To use them:

  1. Create a file in Resources/Shared/ (e.g. NavBar.html)
  2. Reference it in webkit.json
  3. Use it as a property in any page or layout

Example

Resources/Shared/NavBar.html

<nav>
  <a href="/">Home</a>
  <a href="/About.html">About</a>
</nav>

webkit.json

{
  "Properties": {
    "Name": "MySite",
    "Author": "CodingBoson",
    // First, define a property in the `webkit.json` that references the shared HTML/markdown file. "NavBar": "@Shared/NavBar.html"
    "NavBar": "@Shared/NavBar.html"
  }
}

Layout.html

<body>
  {{ .NavBar }}
  <main>{{ .Content }}</main>
</body>

Philosophy

  • No new syntax β†’ Components are just properties.
  • No hidden magic β†’ WebKit doesn’t treat Shared/ specially. It’s just a folder convention.
  • Uniform API β†’ Whether you use .Name, .Author, or .NavBar, it’s the same expression system.

This makes WebKit:

  • Predictable β†’ All resources behave the same
  • Simple β†’ No separate β€œcomponent language”
  • Composable β†’ You can nest and reuse shared parts freely

πŸ“‘ Expressions

# Expressions

WebKit supports **expressions** inside Markdown and HTML.  
They are written with double curly braces:

```markdown
{{ .Property }}

1. Getters

A Getter inserts the value of a property.

Example:

Welcome to {{ .Name }} by {{ .Author }}

With this config:

{
  "Properties": {
    "Name": "MySite",
    "Author": "CodingBoson"
  }
}

Result:

Welcome to MySite by CodingBoson

2. Shared Resource References

Properties in webkit.json can point to other resources, like files in Resources/Shared/.

{
  "Properties": {
    "NavBar": "@Shared/NavBar.html"
  }
}

Now you can use:

{{ .NavBar }}

WebKit will inline the content of Resources/Shared/NavBar.html.


3. SetterExpressions

A SetterExpression allows you to define or override a property inside a page.

Syntax:

{{ .Property = value }}

Example:

{{ .Title = .Name Home }}

# Welcome to {{ .Name }}

Here:

  • .Title is set to "MySite Home"
  • It can be used later in Layout.html (e.g., inside <title>)

4. Concatenation in Setters

Setters can concatenate multiple values:

{{ .Title = .Name " - " .Author }}

With:

{
  "Properties": {
    "Name": "MySite",
    "Author": "CodingBoson"
  }
}

Result:

<title>MySite - CodingBoson</title>

5. Resolution Order

When WebKit resolves an expression:

  1. Check runtime Setters (defined in the current page)
  2. Check webkit.json Properties
  3. If value is a resource reference (e.g., @Shared/...), load its content
  4. Fallback β†’ leave the expression untouched

This makes expressions predictable:

  • Pages can override defaults (via Setters)
  • Layouts and Shared resources stay flexible

6. Escaping Expressions

To write an expression literally (without evaluating it), escape with \\:

\\{{ .Author }}

Result:

{{ .Author }}

Philosophy

Expressions are the glue of WebKit:

  • Getters β†’ read values
  • Setters β†’ define or override values
  • References β†’ pull in resources
  • All unified under one minimal syntax

πŸ‘‰ No custom DSL. πŸ‘‰ No templates-within-templates. πŸ‘‰ Just properties + resources, flowing through the build pipeline.


πŸ“œ License

GPL-3.0 Β© BosonWare Technologies

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.2.0 109 10/2/2025
1.1.0 109 9/30/2025
1.0.0 116 9/29/2025

Support for XDSL (Extensible Data Structure Language) has been added to improve configuration flexibility and usability:
       - Compatible with `webkit.xdsl` or `webkit.json`.