Overview
What Slash Comment does
Prefix every selected line with a slash comment. It runs locally and handles the selected text without contacting a service.
| Category | Developer Tools |
|---|---|
| Action type | JavaScript |
| Default result | Replace or copy text |
| Internet | Not required |
Example
Action and outcome
| Action | Outcome |
|---|---|
| Slash CommentSelected text: first second | // first // second |
Workflow
Use Slash Comment
Follow these steps to prefix every selected line with a slash comment with ActionClip.
- Select the text you want to use.
- Choose Slash Comment from ActionClip.
- Review the result, then replace the selection or copy the new text.
Before you add it
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.
Inspect before installing
Action script
The script below is included so you can inspect how the action works before downloading it.
JavaScript definition
function run(selected_text) {
return selected_text.replace(/\r\n?|\u2028|\u2029|\u0085|\u000B|\u000C/g, "\n")
.split("\n")
.map(function (line) { return "\/\/ " + line; })
.join("\n");
}