> For the complete documentation index, see [llms.txt](https://text.angular-package.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://text.angular-package.dev/introduction.md). Agents can also search and read this documentation through its [MCP server](https://text.angular-package.dev/~gitbook/mcp).

# Introduction

Text on the template with replaceable tags.

## Idea

The package was designed with the idea of having the ability to create a short text on a changeable template with ease-replaceable tags inside it by using [primitive wrapper objects](https://developer.mozilla.org/en-US/docs/Glossary/Primitive#primitive_wrapper_objects_in_javascript)(exactly the [string object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/String)), which primitive value is [immutable](https://developer.mozilla.org/en-US/docs/Glossary/Immutable). These objects were built as general objects with **intuitive** names, **unique** and **most important features** of their names, and in a **simple ease-extendable** form. Objects can be used as the types, which in combination with generic type variables results in **precise functional type** and the advantage of this approach is **functionality follows the type**.

### Elements

Let's deep dive into the elements of the text package. From the bottom of the build hierarchy, there's a [`Wrap`](https://text.angular-package.dev/wrapper/wrap.md) string object that represents a two-character wrap with its main ability to wrap a specified text. This wrap result in a wrapped text of a `string` type.

To create a `Wrap` object there is a need to use a `new` operator, and in addition to this, there's an object `Wrapper`, which helps create it with predefined allowed characters and also wrap the specified text with the use of predefined `Wrap`. So, it is simply a configurable "machine" to build a wrap in a restricted range of characters.

Of course, the `Wrap` object gives a possibility to create a new object with additional features by simply extending it. And by this way string object named `Tag` was created with its main ability to build a tag of a specified name and wrap(e.g. like an HTML tag), which is used to tag a specified text with an opening tag and an automatically created the closing tag.

The last two in the build hierarchy are respectively the `Template` and `Text`, where the first is a string object that contains tags and its equivalent `Tag` objects, and the second is an object consisting of string text and string object `Template` to replace the tags with real words.

Read the next section about the benefits of this approach.
