Developer Tools

HTML Comment

Wrap selected text in an HTML comment.

OfficialOn-device

Download action

What HTML Comment does

Wrap selected text in an HTML comment. It runs locally and handles the selected text without contacting a service.

CategoryDeveloper Tools
Action typeJavaScript
Default resultReplace or copy text
InternetNot required

Action and outcome

HTML Comment example
ActionOutcome
HTML CommentSelected text: navigation <!-- navigation -->

Use HTML Comment

Follow these steps to wrap selected text in an HTML comment with ActionClip.

  1. Select the text you want to use.
  2. Choose HTML Comment from ActionClip.
  3. Review the result, then replace the selection or copy the new text.

Requirements and privacy

  • Before you start: No setup required.
  • Your selected text: Runs locally in ActionClip’s JavaScript sandbox. Selected text does not leave your Mac.

Action script

The script below is included so you can inspect how the action works before downloading it.

JavaScript definition
function run(selected_text) {
  var match = selected_text.match(/^(\s*)([\s\S]*?)(\s*)$/u);
  return match[1] + "<!-- " + match[2] + " -->" + match[3];
}