Using HTML entities

When you want to use html entities in your code, you will notice that most editors will convert them to actual characters when saving.

You can prevent that from happening by adding an underscore (_) after & to escape it, like:

{source}Sch&_ouml;n{/source}

Not using a WYSIWYG editor?

Sourcerer is designed to be used with a WYSIWYG editor. It will strip all tags entered in the HTML/Code view of the content, to prevent styling from messing with the code.

When you do not use a WYSIWYG editor (or the field where you want to enter the code has no editor), practically all code would be stripped, which you don't want of course.

To prevent Sourcerer from stripping the HTML code, you can add a raw="true" attribute in the {source} tag, like:

{source raw="true"}<p>Code in an <strong>HTML</strong> editor</p>{/source}

Strip surrounding HTML tags

By default Sourcerer will output your code right inside your content where you placed your {source} tags.

However, most editors treat new lines as paragraphs, meaning that the {source} tags will get surrounded by <p> tags.

If you - for instance - include a file through Sourcerer that outputs a table, and your {source} tags are surrounded by <p> tags, then you would get a table inside a paragraph, which you don't want of course.

To make Sourcerer remove the surrounding paragraph tags (or span tags), you can switch on the Strip surrounding tags option in the Sourcerer system plugin settings.

Or you can individually override this setting in the {source} tag by adding a trim="..." attribute with either a true (on) or false (off) value:

<p>{source trim="true"}Surrounding paragraph will be stripped from the output{/source}</p>

For more troubleshooting tips in case something doesn't work as expected, check out the Frequently Asked Questions page.

Exclude an edit form

On an edit page, add the no-sourcerer class to the <form> element to keep Sourcerer tags in that form's text inputs and textareas from being processed while the form is displayed.

Browser Page Titles

When Enable in Head is enabled, Sourcerer supports tags in an article's Browser Page Title and in the active menu item's Browser Page Title. Article titles use the article's verified creator and last-modifier security policy. Menu titles are administrator-managed content and use the Other Areas policy.

Enable in Head does not make arbitrary document-head input trusted. The configured area, code-type, and unverified-content security controls still apply.