Drupal Tokens: How to remove the line-breaking paragraph tag <p> from tokens used within nodes

Tokens are simple strings of text that serve as place holders for an as of yet unknown dynamic value. Tokens allows you to use small place holders to automatically complete tasks. To take a simple example, if you put [site:name] on your site, it will be replaced by the actual name of your site. To take a more complicated example, you can use Token together with the Pathauto module to automatically create URL patterns for your whole site.

When one uses field tokens within a node (Example: [node:field_test_field]) with a standard configuration the line-breaking tag p is added to the printed token. But in many case we only want to print the plain token value. While it is easy to solve the issue using views - by using Rewrite with the option "Strip HTML tags" - it is a little more complicated when using tokens in nodes.

The following solutions worked for us, although we are not sure if there is a more elegant solution:

a) If the node field only contains the token
1. Create or use a text format where the option "Convert line breaks into HTML (i.e. br and p)" is unchecked
2. Assign this text format to the node field

b) If the node field contains various elements and you need to use the option "Convert line breaks into HTML (i.e. br and p)"
1. Create a hidden node field [field_hidden_field] where you print the token [node:field_test_field]
2. Create or use a text format where the option "Convert line breaks into HTML (i.e. br and p)" is unchecked
3. Assign this text format to the hidden node field
4. Reprint the hidden node field using again a token [node:field_hidden_field] in the node field

List of tokens:
https://www.drupal.org/node/390482#drupal7tokenslist

Drupal Tokens
Taxonomy: 

Drupal themes to be compared