metadatamultilinetampermonkeyuserscriptsgreasemonkey-4

How to define multi-line @description metadata?


None of the following works:

// @description  ...text1...
// @description  ...text2...

Only text2 is displayed.

// @description  ...text1...
                 ...text2...

Only text1 is displayed.

// @description  ...text1...
//               ...text2...

Only text1 is displayed.

// @description  ...text1...<br />...text2...

Literal <br /> is displayed.

// @description  ...text1...\n...text2...

Literal \n is displayed.


Solution

  • You don't. The general idea was that the description was supposed to be concise "Microcontent" and the size can't be too large without making the extension UI much more cumbersome.

    The Greasemonkey doc says:

    Just a brief summary of what the script does, presented to the user as the script is installed, and in the manage dialog.

    The Tampermonkey doc says:

    A short significant description.

    The Violentmonkey doc says:

    A brief summary to describe the script.

    Now, you could submit feature requests or pull requests to try to get that changed but I think going for the usability/TLDR/"Executive Summary" approach is better.

    So:

    1. Use an SEO-like useful, descriptive title.
    2. If the description seems to need more than about 128 characters (A) you're doing it wrong and/or (B) Link to a proper wiki/FAQ/homepage.
    3. Make use of the @homepage and the @supportURL keys. Both Tampermonkey and Violentmonkey will also use these to place link icons in various places. (You shouldn't be using Greasemonkey 4+, anyway, as discussed elsewhere.)

    So here are some examples:

    1. No description needed:

      // @name     YouTube, hide all comments.
      
    2. Short description helps:

      // @name        YouTube, redirect to show only Yanni videos.
      // @description Chooses the best Yanni-related replacement for any YouTube video.
      
    3. Really want lots of description:

      // @name        Stack Overflow, Insta-answer with guaranteed vote magnets.
      // @description See the terms, conditions and FAQS at stackingtheodds.mil.
      
    4. Semi-useless description but full leverage of support URL's and icons:

      // @name        Stack Exchange, replace badge icons with duckies
      // @description Does what it says on the tin.
      // @homepage    https://stackapps.com/q/8116/7653
      // @supportURL  https://github.com/BrockA/SE-misc/blob/master/Stack%20Exchange,%20replace%20badge%20icons%20with%20duckies.user.js