<!-- prettier-ignore-start -->
# Class MarkupText

- [TopLevel.Object](TopLevel.Object.md)
  - [dw.content.MarkupText](dw.content.MarkupText.md)

The class represents a content snippet with markup. This is typically a
HTML content snippet. The class also processes the special links from
Commerce Cloud Digital content management and automatically rewrites them into
links for use in the storefront.


The following special links can be used inside of a MarkupText:



- `**$url('<pipeline>' [, '<key1>', '<value1>', '<key2>', '<value2>', ...])$**`

_Description:_
The`$url()$`function creates and absolute URL and retains the protocol incoming
request.
_Example:_
MarkupText:
&nbsp;&nbsp;&nbsp;`$url('MyLinkPipeline-Start', 'key1', 'value1', 'key2', 'value2')$`
is rewritten to:
&nbsp;&nbsp;&nbsp;`http://<host>:<port>/on/demandware.store/<current site>/default/MyLinkPipeline-Start?key1=value1&key2=value2`
Note that the incoming protocol was http in the example above.
- `**$httpUrl('<pipeline>' [, '<key1>', '<value1>', '<key2>', '<value2>', ...])$**`

_Description:_
The`$httpUrl()$`function creates an absolute URL but always with the fix protocol
"http". The protocol type of the incomming request is ignored.

_Example:_
MarkupText:
&nbsp;&nbsp;&nbsp;`$httpUrl('MyLinkPipeline-Start', 'key1', 'value1', 'key2', 'value2')$`
is rewritten to:
&nbsp;&nbsp;&nbsp;`http://<host>:'<port>/on/demandware.store/<current site>/default/MyLinkPipeline-Start?key1=value1&key2=value2`
- `**$httpsUrl('<pipeline>' [, '<key1>', '<value1>', '<key2>', '<value2>', ...])$**`

_Description:_
The`$httpsUrl()$`function creates an absolute URL but always with the fix protocol
"https". The protocol type of the incomming request is ignored.
_Example:_
MarkupText:
&nbsp;&nbsp;&nbsp;`$httpsUrl('MyLinkPipeline-Start', 'key1', 'value1', 'key2', 'value2')$`
is rewritten to:
&nbsp;&nbsp;&nbsp;`https://<host>:<port>/on/demandware.store/<current site>/default/MyLinkPipeline-Start?key1=value1&key2=value2`

- `**$include('<pipeline>' [, '<key1>', '<value1>', '<key2>', '<value2>', ...])$**`

_Description:_
The`$include()$`function creates a relative URL which is post processed by the
Commerce Cloud Digital Webadapter. The result is the content generated by the given pipeline call.
_Example:_
MarkupText:
&nbsp;&nbsp;&nbsp;`$include('MyIncludePipeline-Start','key1', 'value1', 'key2' ,'value2')$`
results in the content delivered by the 'MyIncludePipeline-Start' pipeline.
- `**...?$staticlink$**`

_Description:_
The`$staticlink$`function can be used to create a URL to a static resource
(such as an image). The URL being generated depends on the owner of the MarkupText instance.
For example, a product's long description (which is a MarkupText) will generate
links to static resources within the catalog. Possible URL targets are catalogs
(for catalog related objects like products and categories), the content library
(for library related objects like folders and assets) or the organization
(for all objects that are not catalog or library related).
_Example:_
MarkupText: (owned by a content asset)
&nbsp;&nbsp;&nbsp;`<img src="demo/content/bullet.gif?$staticlink$">`
is rewritten to:
&nbsp;&nbsp;&nbsp;`<img src="/on/demandware.static/<current site>/<library>/default/v1178201405900/demo/content/bullet.gif">`



Note: The comma symbol `,` is not supported in parameter values for the link functions.



## Property Summary

| Property | Description |
| --- | --- |
| [markup](#markup): [String](TopLevel.String.md) `(read-only)` | Returns the content with all links rewritten for storefront use. |
| [source](#source): [String](TopLevel.String.md) `(read-only)` | Returns the original content source, without any links re-written. |

## Constructor Summary

This class does not have a constructor, so you cannot create it directly.
## Method Summary

| Method | Description |
| --- | --- |
| [getMarkup](dw.content.MarkupText.md#getmarkup)() | Returns the content with all links rewritten for storefront use. |
| [getSource](dw.content.MarkupText.md#getsource)() | Returns the original content source, without any links re-written. |
| [toString](dw.content.MarkupText.md#tostring)() | Returns a string representation of this class, the same as getMarkup(). |

### Methods inherited from class Object

[assign](TopLevel.Object.md#assignobject-object), [create](TopLevel.Object.md#createobject), [create](TopLevel.Object.md#createobject-object), [defineProperties](TopLevel.Object.md#definepropertiesobject-object), [defineProperty](TopLevel.Object.md#definepropertyobject-object-object), [entries](TopLevel.Object.md#entriesobject), [freeze](TopLevel.Object.md#freezeobject), [fromEntries](TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](TopLevel.Object.md#hasownpropertystring), [is](TopLevel.Object.md#isobject-object), [isExtensible](TopLevel.Object.md#isextensibleobject), [isFrozen](TopLevel.Object.md#isfrozenobject), [isPrototypeOf](TopLevel.Object.md#isprototypeofobject), [isSealed](TopLevel.Object.md#issealedobject), [keys](TopLevel.Object.md#keysobject), [preventExtensions](TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](TopLevel.Object.md#propertyisenumerablestring), [seal](TopLevel.Object.md#sealobject), [setPrototypeOf](TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](TopLevel.Object.md#tolocalestring), [toString](TopLevel.Object.md#tostring), [valueOf](TopLevel.Object.md#valueof), [values](TopLevel.Object.md#valuesobject)
## Property Details

### markup
- markup: [String](TopLevel.String.md) `(read-only)`
  - : Returns the content with all links rewritten for storefront use.


---

### source
- source: [String](TopLevel.String.md) `(read-only)`
  - : Returns the original content source, without any links re-written.


---

## Method Details

### getMarkup()
- getMarkup(): [String](TopLevel.String.md)
  - : Returns the content with all links rewritten for storefront use.

    **Returns:**
    - the content with all links rewritten for storefront use.


---

### getSource()
- getSource(): [String](TopLevel.String.md)
  - : Returns the original content source, without any links re-written.

    **Returns:**
    - the original content source, without any links re-written.


---

### toString()
- toString(): [String](TopLevel.String.md)
  - : Returns a string representation of this class, the same as getMarkup().

    **Returns:**
    - a string representation of this class, the same as getMarkup().


---

<!-- prettier-ignore-end -->
