<commit_before># Building HTML

## Content

- [Entities](#entities)
- [Scripts And Style Sheets](#scripts-and-style-sheets)
- [Links](#links)
- [Links To Named Routes](#links-to-named-routes)
- [Links To Controller Actions](#links-to-controller-actions)
- [Mail-To Links](#mail-to-links)
- [Images](#images)
- [Lists](#lists)
- [Custom Macros](#custom-macros)

<a name="entities"></a>
## Entities

When displaying user input in your Views, it is important to convert all characters which have significance in HTML to their "entity" representation.

For example, the < symbol should be converted to its entity representation. Converting HTML characters to their entity representation helps protect your application from cross-site scripting:

#### Converting a string to its entity representation:

	echo HTML::entities('<script>alert('hi');</script>');

#### Using the "e" global helper:

	echo e('<script>alert('hi');</script>');

<a name="scripts-and-style-sheets"></a>
## Scripts And Style Sheets

#### Generating a reference to a JavaScript file:

	echo HTML::script('js/scrollTo.js');

#### Generating a reference to a CSS file:

	echo HTML::style('css/common.css');

#### Generating a reference to a CSS file using a given media type:

	echo HTML::style('css/common.css', 'print');

*Further Reading:*

- *[Managing Assets](/docs/views/assets)*
<commit_msg>Update "docs/views/html.md", parse error in example code.<commit_after># Building HTML

## Content

- [Entities](#entities)
- [Scripts And Style Sheets](#scripts-and-style-sheets)
- [Links](#links)
- [Links To Named Routes](#links-to-named-routes)
- [Links To Controller Actions](#links-to-controller-actions)
- [Mail-To Links](#mail-to-links)
- [Images](#images)
- [Lists](#lists)
- [Custom Macros](#custom-macros)

<a name="entities"></a>
## Entities

When displaying user input in your Views, it is important to convert all characters which have significance in HTML to their "entity" representation.

For example, the < symbol should be converted to its entity representation. Converting HTML characters to their entity representation helps protect your application from cross-site scripting:

#### Converting a string to its entity representation:

	echo HTML::entities('<script>alert(\'hi\');</script>');

#### Using the "e" global helper:

	echo e('<script>alert(\'hi\');</script>');

<a name="scripts-and-style-sheets"></a>
## Scripts And Style Sheets

#### Generating a reference to a JavaScript file:

	echo HTML::script('js/scrollTo.js');

#### Generating a reference to a CSS file:

	echo HTML::style('css/common.css');

#### Generating a reference to a CSS file using a given media type:

	echo HTML::style('css/common.css', 'print');

*Further Reading:*

- *[Managing Assets](/docs/views/assets)*

{'fraction_non_alphanumeric': 0.1532083633741889, 'fraction_numerical': 0.0, 'mean_word_length': 5.1529933481153, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '652178', 'n_tokens_mistral': 843, 'n_tokens_neox': 800, 'n_words': 274}