Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <main>
  <section>
    <h1>Template Plugin: Advanced Templates</h1>
    <p>This is an example of using more advanced template source with the <a href="https://www.tiny.cloud/docs/plugins/template/" target="_blank">template</a> plugin in TinyMCE 5.</p>
    <textarea></textarea>
    <p>For this example, the template source is within the TinyMCE init configuration. This will make it easier to
      play with the example. In a real-world use case, you may like to use <a href="https://www.tiny.cloud/docs/plugins/template/#templates" class="_blank">externally hosted templates</a>.</p>
    <p>When using advanced templates like this, place the "<a href="https://www.tiny.cloud/docs/plugins/template/#makingtemplates" target="_blanl">mceTmpl</a>"
      class to the wrapper of the actual content you want inserted. TinyMCE will insert this element as the actual template.</p>
  </section>
</main>
              
            
!

CSS

              
                body {
  margin: 2rem 1.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial,
    sans-serif;
}

main {
  max-width: 720px;
  margin: auto;
}

section {
  margin-bottom: 3rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: bold;
}

a {
  color: rgb(25, 118, 210);
  font-weight: bold;
  text-decoration: none;
}

a:hover {
  color: rgb(145, 180, 225);
}

              
            
!

JS

              
                tinymce.init({
  selector: "textarea",
  plugins: "template code",
  toolbar: "template code",
  menubar: false,

  min_height: 380,
  templates: [
    {
      title: "Advanced Template template example",
      description:
        'This template has additional markup that is shown in the "preview" of the template, but is not inserted in to TinyMCE.',
      content:
        "<body>" +
        '<p style="color: red; font-weight:bold;">This appears in the template preview, but will not be inserted in to TinyMCE.</p>' +
        '<div class="mceTmpl">' +
        "<p>This is the actual template content that will be inserted.</p>" +
        "<ul>" +
        "<li>And can include nested elements</li>" +
        "<li>So your templates can still include your complex HTML</li>" +
        "</ul>" +
        "</div>" +
        "</body>"
    }
  ]
});

              
            
!
999px

Console