Novicell.Umbraco.Typography 17.0.0-beta.2

This is a prerelease version of Novicell.Umbraco.Typography.
dotnet add package Novicell.Umbraco.Typography --version 17.0.0-beta.2
                    
NuGet\Install-Package Novicell.Umbraco.Typography -Version 17.0.0-beta.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Novicell.Umbraco.Typography" Version="17.0.0-beta.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Novicell.Umbraco.Typography" Version="17.0.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Novicell.Umbraco.Typography" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Novicell.Umbraco.Typography --version 17.0.0-beta.2
                    
#r "nuget: Novicell.Umbraco.Typography, 17.0.0-beta.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Novicell.Umbraco.Typography@17.0.0-beta.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Novicell.Umbraco.Typography&version=17.0.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Novicell.Umbraco.Typography&version=17.0.0-beta.2&prerelease
                    
Install as a Cake Tool

Novicell.Umbraco.Typography

Typography helpers for Umbraco editors. The first feature is soft hyphens (&shy;, U+00AD): editors can see them and insert them, both in text boxes and in the rich text editor (Tiptap).

Long words in headings often overflow on small screens. A soft hyphen marks where a word may break; the browser only shows a hyphen when it actually breaks the line there. The character is invisible, so editors normally can't see or place it. This package fixes that.

Beta. This package is still being tested. Expect changes before the first stable release, and try it on a copy of your site before using it in production.

Requires Umbraco 17.

Versions

The package's major version follows the lowest Umbraco major version it supports: 17.x works with Umbraco 17. The current version is 17.0.0-beta.1.

Features

Text Box (typography)

A property editor UI for the built-in Umbraco.TextBox schema, so you can switch an existing Textstring data type to it without migrating any content.

  • Soft hyphens are shown as ¬ while editing, the same symbol Word uses for optional hyphens
  • Insert with Ctrl+- (Cmd+- on Mac, the same shortcut Word uses) or the soft hyphen button next to the field
  • Typing or pasting &shy; turns it into a soft hyphen
  • The eye button toggles a preview of the real text below the field. Drag its corner to see where the text breaks
  • Supports the Text Box's max characters setting, mandatory validation and read-only mode

Rich text editor (Tiptap)

  • Tiptap extension Soft hyphen and a toolbar button
  • Soft hyphens are shown as a red ¬ in the editor
  • Insert with Ctrl+- or the toolbar button. Bold, italic and links are kept around it
  • Soft hyphens in existing content, and in pasted text, are shown automatically

Server

  • Search: soft hyphens are removed from all Examine indexes, so "international" finds "inter­national"
  • StripSoftHyphens(): a string extension for places where text isn't laid out by a browser, such as <title>, meta tags, JSON-LD and alt text
using Novicell.Umbraco.Typography.Extensions;

<title>@Model.Value<string>("header").StripSoftHyphens()</title>

Headless

The Delivery API returns the values with the U+00AD character, so a headless front end needs nothing special in the page itself: set the text as text and the browser breaks words at the soft hyphens. For <title>, meta tags and the like, strip them the way StripSoftHyphens() does:

const stripSoftHyphens = (text) => text.replace(/­|&(?:shy|#173|#x0*ad);/gi, '');

document.title = stripSoftHyphens(page.properties.header);

The test site has an example, see Development.

How values are stored

Both editors store the real U+00AD character, never &shy; as text and never the ¬ marker. Templates and the Delivery API need nothing special: Razor writes the character as &#xAD; in encoded output, and as is in rich text.

Values with &shy; (or &#173;, &#xAD;) stored as text, which older soft hyphen editors did, are also understood:

  • On read, they are converted. A property using Text Box (typography) is read with the U+00AD character, in templates, in the Delivery API and inside blocks, so nothing shows a literal "­" and no Html.Raw() is needed. Plain Textstrings, and rich text where &shy; is valid HTML, are left to Umbraco.
  • In the backoffice, the text box shows them as ¬ and stores U+00AD the first time the editor changes the field.
  • Search and StripSoftHyphens() remove both forms.

The stored values stay as they are until they are saved again; the migration cleans them up in one go.

Setup in a site

  1. Install the package
  2. Text box: Settings › Data types › your Textstring (or a new data type) › change the property editor to Text Box (typography)
  3. Rich text: Settings › Data types › Richtext editor › tick Soft hyphen under capabilities and drag the button into the toolbar

Migrating from an older soft hyphen editor

The package has a migration for sites that used an older soft hyphen editor. It is off by default, so installing the package never changes content by itself. Turn it on in appsettings:

"Novicell": {
  "Typography": {
    "Migration": {
      "Enabled": true,
      "LegacyEditorAliases": [ "Your.Old.EditorAlias" ]
    }
  }
}

It runs once, at the next startup (or from Packages › Installed in the backoffice if Umbraco:CMS:Unattended:PackageMigrationsUnattended is off), and then:

  1. Switches data types using one of LegacyEditorAliases to Text Box (typography).
  2. Normalizes every value of those data types and of existing Text Box (typography) data types. Each value is treated as a plain string, whichever column it is stored in, moved to the column Text Box uses, and &shy;, &#173; and &#xAD; become the U+00AD character. This covers all versions and all languages.
  3. Normalizes values inside blocks. For these properties on element types in Block List, Block Grid and rich text blocks, including nested blocks and properties an element type gets from a composition, values are normalized in the block JSON, and an old editorAlias there is updated.
  4. Rebuilds the published cache if anything changed.

It logs what it did, starting with Soft hyphen migration:. Things to know:

  • Values over 512 characters are skipped with a warning that names the content node and property. A Text Box can't hold them, so they are left as they were, with &shy; as text. Umbraco still reads them, so they show in the backoffice and the Delivery API; shorten them, and the text box converts &shy; when the field is changed.
  • Rich text markup is not touched. &shy; is valid HTML there.
  • uSync: after the migration, run a full export, not just the data types. uSync also stores the editor alias of each property in every content type's file, so with only the data types exported, the content types still say the old editor, and uSync imports them again on every startup.
  • It runs once. Values that arrive later in the old form, from a uSync import of content from a server still on the old editor for example, are not changed in the database, but are converted when they are read (see How values are stored).
  • Running it again: Umbraco records that it has run. To run it again, for example after adding another alias, delete the row Umbraco.Core.Upgrader.State+Novicell.Umbraco.Typography from umbracoKeyValue and restart.
  • Back up the database first, as with any migration.

Development

src/
  Novicell.Umbraco.Typography/            the package (Razor Class Library)
    Client/                               backoffice code (TypeScript, Lit, Vite)
      src/core/soft-hyphen.ts             shared constants and helpers
      src/icons/                          the soft hyphen icon
      src/property-editors/text-box/      Text Box (typography)
      src/tiptap/                         Tiptap extension and toolbar button
      src/lang/                           English and Danish texts
    Composers/, Search/, Extensions/      server side
    Migrations/                           migration from older soft hyphen editors
  Novicell.Umbraco.Typography.TestSite/   Umbraco site for development (SQLite)
tests/
  Novicell.Umbraco.Typography.Tests/      .NET tests (TUnit)

Build the client before building or running the .NET solution. The output goes to wwwroot/App_Plugins/NovicellUmbracoTypography, which isn't committed:

cd src/Novicell.Umbraco.Typography/Client
npm install
npm run build        # or: npm run watch

Then run the test site:

dotnet run --project src/Novicell.Umbraco.Typography.TestSite

It installs itself on first run. Log in at https://localhost:44352/umbraco with admin@example.com / 1234567890 (see appsettings.Development.json).

On a fresh install, uSync imports a ready-made setup from uSync/v17:

  • Article document type with the Article template, which shows how to use StripSoftHyphens() in <title>
  • Header (typography) data type, using Text Box (typography)
  • Richtext editor data type, with the soft hyphen extension and toolbar button enabled
  • Content internationalization, a sample article with soft hyphens in the header and the body, at https://localhost:44352/. Make the window narrow to see the long words break.

The Delivery API is switched on with public access, so the sample article is also at https://localhost:44352/umbraco/delivery/api/v2/content/item/, and https://localhost:44352/headless/ is the same page built from it in the browser (wwwroot/headless/app.js, plain JavaScript, no build step). It shows the headless side of Headless: the soft hyphens set as text in the page, and stripped from the tab's title. Each page links to the other; /headless/?path= takes the URL of another article.

uSync exports changes when you save, so remember to commit uSync/ if you change these types or the sample article. Articles you create to try things are exported to uSync/v17/Content too; leave those out.

Tests

cd src/Novicell.Umbraco.Typography/Client
npm test             # Vitest

dotnet test          # TUnit, from the repository root

scripts/Test-UmbracoVersions.ps1 (PowerShell 7) runs the test site on several Umbraco 17 versions, each on a fresh database of its own, and runs scripts/backoffice-smoke.mjs against it: in the backoffice, soft hyphens are inserted in Text Box (typography) and the rich text editor with the shortcut and the buttons, and the saved values, the published page, the Delivery API, the headless page and the backoffice search are checked. Then scripts/migration-smoke.mjs adds content as an older soft hyphen editor left it, and checks it after a restart with the migration on. It needs the client's npm packages and Chrome, and stops a running test site first. The logs and screenshots end up in artifacts/umbraco-versions/<version>/.

./scripts/Test-UmbracoVersions.ps1                                  # 17.0.0, 17.4.2 and 17.8.0
./scripts/Test-UmbracoVersions.ps1 -Versions "17.0.0=17.0.0", "17.6.2" # Umbraco version=uSync version

The test site's own versions are TestSiteUmbracoVersion and TestSiteUSyncVersion in Directory.Packages.props. See scripts/README.md for what it checks and how to read the results.

Branches and releases

Branch Purpose
v17/dev Development for Umbraco 17. Pull requests go here.
v17/main Releases for Umbraco 17. Merge v17/dev into it when a version is ready.

The next Umbraco LTS gets its own pair, e.g. v21/dev and v21/main.

CI (.github/workflows/ci.yml) runs on every pull request and on pushes to v*/dev and v*/main. It builds and tests the client and the .NET solution, and uploads the NuGet package as an artifact, so it can be downloaded and tried before a release.

Releasing (.github/workflows/release.yml):

  1. Merge v17/dev into v17/main.
  2. On GitHub, create a release from v17/main with a tag like v17.0.0 or v17.0.0-beta.1. Tick Set as a pre-release for versions with -beta and the like.
  3. Approve the deployment to the nuget environment when GitHub asks.

The workflow first runs the smoke test (.github/workflows/smoke.yml, see scripts/README.md) on Umbraco 17.0.0, 17.4.2 and 17.8.0, and publishes nothing if it fails. The smoke test can also be started by hand from the Actions tab. The workflow then builds with the version from the tag, publishes to NuGet.org and attaches the package to the release. Once the new version is on nuget.org, it runs the smoke test again on a site that installs it from there (.github/workflows/nuget-test.yml), which can also be started by hand for any published version. The versions in the repository's files don't need updating by hand. It refuses to publish if:

  • the tag's major version doesn't match the Umbraco version in Directory.Packages.props
  • the tag isn't on v<major>/main
  • the release's pre-release setting doesn't match the version

One-off setup

  • NuGet.org: under the Novicell account, add a Trusted Publishing policy for repository owner Novicell, repository Novicell.Umbraco.Typography, workflow file release.yml and environment nuget.
  • GitHub:
    • the environment nuget, limited to v* tags, is created. Add required reviewers once the repository is public; GitHub's plan doesn't allow them on a private one
    • add the repository variable NUGET_USER, the NuGet.org user name that owns the policy
    • protect v17/dev and v17/main with the CI check as required

Implementation notes

  • The text box marker is a real character. A plain <input> can't style a single invisible character, so U+00AD ⇄ ¬ is swapped when displaying and saving. ¬ is what Word shows for an optional hyphen, and it doesn't occur in normal text. If an editor does type one in a text box, it becomes a soft hyphen. Colouring it would take an overlay behind a transparent input; we've chosen the simpler plain character.
  • The buttons follow Umbraco's own patterns: the insert button is placed next to the field like the remove button in Repeatable Textstrings, and the preview toggle switches look like the lock toggle in the image dimensions input.
  • The icon is the ISO/IEC 60417-6073 symbol for soft hyphen (Wikimedia Commons, public domain), redrawn in the style of Umbraco's icons and registered as icon-novicell-soft-hyphen.
  • In Tiptap, a soft hyphen is an inline atom node with a node view that draws the marker. Umbraco only exposes @tiptap/core, not ProseMirror's Plugin/Decoration, so decorations aren't possible without bundling a second copy of ProseMirror, which breaks once other decorations are active.
  • ProseMirror can't serialize a node to bare text, so the node renders as <span data-novicell-soft-hyphen>­</span>. The extension wraps the editor's getHTML(), which Umbraco calls when saving, and unwraps the span. If Umbraco ever stops using getHTML(), the span is saved instead. It still contains a working soft hyphen.
  • Initial content is converted before parsing (onBeforeCreate), so opening a page with soft hyphens doesn't count as a change. Later content (paste, setContent()) is converted in onUpdate, outside the undo history.
  • Ctrl+- normally zooms out in the browser. The fields only take it over while they have focus.

Ideas for later features

Non-breaking space, non-breaking hyphen (U+2011), zero-width space / <wbr>, and typographic quotation marks and dashes. They all fit the same pattern: a visible marker while editing, a button and shortcut for inserting, and stripping or normalising on the server.

License

MIT, see LICENSE.md. Copyright © Novicell.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
17.0.0-beta.2 143 11/2/2026
17.0.0-beta.1 75 11/1/2026