#
Pretty Diff - Guide: Ignoring specified tags from markup beautification

Color Scheme

Explore some samples or browse Pretty Diff on GitHub.

## Ignoring specified tags from markup beautification

### Introduction

There are moments we could sell a markup beautification program to selectively ignore certain tags from beautification. This is particularly important when certain elements are used in connection with CSS's white-space property where the white space characters will be literally formatted as output.

### Custom data attribute

The markup_beauty and markupmin libraries attempts to solve this problem by watching for a custom data attribute. When this data attribute is encountered on a start tag all contents up to and including the matching end tag are skipped over. Since the library attempts to couple the end tag and everything in between this means all ancestor nodes escape beautification or minification. If the data attribute is present on the root element then the entire document will be escaped from processing. The data attribute is:

`data-prettydiff-ignore`

The markup_beauty library is only looking for the attribute name and not any particular value. XML syntax requires the use of a value, so for correctness I provide the value true. For an example try to beautify the code from the diff command line guide and examine the code tags.

This data attribute is automatically included on the HTML output for the jsscope feature with several examples on the closure guide.

For additional options check out the documentation. I take bug and suggestions for enhancements via email and at Github.