Wrap text with tags in Notepad++ A macro can do that and it’s easier than you think. If you need to wrap the text with html tags or WordPress Gutenberg code blocks or paragraph block or a heading block.

Start by selecting the text:

  • In Notepad++ menu Click Macro > Start Recording.
  • Ctrl+X – Cut the text as the first action.
  • Type the text that should go before the original text. for example <p>
  • Ctrl+V Paste the original text back at the cursor – goes after the <p> you just typed earlier.
  • Type the text that goes after. For example a closing tag </p>
  • In Notepad++ menu Click Macro > Stop Recording.
  • In the same menu click Save Current Recorded Macro. You can even assign a shortcut key combination to it.

Now whenever you want to wrap text in custom tags you select the text and run the macro.

I recorded macros to build WordPress Gutenberg blocks.

Heading block:

<!-- wp:heading -->
<h2>Heading Text</h2>
<!-- /wp:heading -->

Paragraph block:

<!-- wp:paragraph -->
<p>Some text</p>
<!-- /wp:paragraph -->

Code block:

<!-- wp:code -->
<pre class="wp-block-code"><code>the codes...</code></pre>
<!-- /wp:code -->

You can do this trick with any text you might want to wrap around your original text. If can be anything, simple text, tags, brackets, unicorns, anything you want. This post was actually built with these shortcuts. I prefer it like this than the Visual editor Gutenberg for WordPress blocks.



Comments

One response to “Wrap text with tags in Notepad++”

  1. it’s great!
    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.