How to define multi-line #description metadata? - 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.

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:
Use an SEO-like useful, descriptive title.
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.
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:
No description needed:
// #name YouTube, hide all comments.
Short description helps:
// #name YouTube, redirect to show only Yanni videos.
// #description Chooses the best Yanni-related replacement for any YouTube video.
Really want lots of description:
// #name Stack Overflow, Insta-answer with guaranteed vote magnets.
// #description See the terms, conditions and FAQS at stackingtheodds.mil.
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

Related

Doxygen: extract specific doxygen defines into separate documentaion

I have some source code (STM32 Peripherial Lib) with existing doxygen parameters which my Doxygen Builds without Problems.
For my project I want to generate a document with all functions in each file and a specific information which I want to add to the functions. But I want to keep the old informations for another doxygen configuration.
Is that possible?
I already added this for testing:
\ifnot "SECTION_DEFINE"
<normal Doxygen Parameters from original Source Code>
\elsif "SECTION_DEFINE"
#brief Function Check TODO
\endif
With this I could deactivate the existing documentation, but I need to write this \ifnot \elsif \endif to every function.
Can I just declare a Tag and only generate the documentation for this specific tag?
Kind regards
Andi
You may create a "related page" where only your additional information will be displayed with the \xrefitem command. As \xrefitem will also create a special text section within your original documentation you may want to combine it with your original idea of using section labels and conditional documentation. To top this concept off, use aliases in order to make your documentation more readable.
Consider this example code:
/** ST documentation
* foobar
* \exclusive for andi's function \endif
*/
void andreas(void);
/** ST documentation
* foobar
* \exclusive for beni's function \endif
*/
void benjamin(void);
You may use this alias in your Doxyfile: exclusive=\if SECTION_DEFINE \xrefitem viparea "Exclusive" "VIPs".
As long as SECTION_DEFINE is not defined, the "exclusive" information will not be included in your documentation. As soon as this section is defined, a "related page" (here: viparea.html) is created in your HTML documentation containing your documented items (here: andreas and benjamin) with the exclusive paragraph behind the command. The result:

Create a link to the header of another page in Github

Does anyone know how to create a link to the header of a different wiki page?
I know if I have a header ##Header name that I can link to it on that page by using (#header-name) as my link, but I want to link to that header from a different page. Is this possible?
ie. I want to have a table of contents that can link to the sub-sections of each wiki page as well as to the page itself.
Edit: I mean a way besides just using the url link
http://github.com/project/wiki/Wiki-Page#header-name
EDIT 1: So totally wrong about before, I just read up a bit more. So we have this new support as well inside of GitHub Wikis! (Relatively new.)
You can also do something like this:
[[ Link text | page_title#header_title ]]
This might work a lot better for you! TIL because of this answer here. You can see me do this with the Prerequisite link and you can see my other links work the other way. Time for me to do some updates!
EDIT 1: Still useful but definitely NOT THE ONLY WAY.
So I answered a question about this before, you should avoid absolute links on GitHub (i.e. https://github.com/user/repo_name/...)
However, a good way (and kind of the only way inside of Wikis EDIT 1: TOTALLY NOT TRUE TO BEING THE ONLY WAY) of doing what you need can be seen like this:
[Header link](/user/repository_name/wiki/page_name#title).
This is kind of the linking unfortunately that the Wiki would support. This will change your directory page based off of GitHub. You can see that it would be
https://github.com/(the linkage you want to hit)
I have actually began doing something like this in a Wiki I work on here. Inside of my Sidebar, you can see I have a Getting Started Page, and then a subsection into it is a Prerequisite heading and it will properly lead people to where they need to go. You would be able to perform this same thing on any page. It is a tad verbose, but worth it as you can easily change things around if need be. This is also case-sensitive since it will change their location so be sure that in your linkage, the page is the proper case and your heading is all lowercase.
Hope this helps!
You can link to the header by simply assigning an id to header. e.g you've "Extension" header in a page called Abc.
# <a id="extension"></a> Extensions
You have another page "Call center" and you want to go to extension in abc , you can use reference linking of markdown i.e "The [extensions][1] are handled by agents"
[1]: url-of-abc/#extension
I tested Maxwell's "good way" to link to the header of another page in Github in Edit 1 on and it works perfectly.
#[crux-ports Installation](/user/crux-ports/blob/master/README.md#installation)
markdown generate slug for the heading and convert it to id, example
# [ topic ][ color ]
will be converted to
<h1 id="topic--color" data-line="643" class="code-line">[ topic ][ color ]</h1>
Thus, to link it you can write it as [color](#topic--color).
If the destination anchor is on another page (assume filename css.md) with path relative to current markdown page, then you can write it as [color](css.md#topic--color)
Attach the slugify function from vscode
// excerpt from https://github.com/yzhang-gh/vscode-markdown/blob/908d7ba5465a203e4299f346c179211d992ef468/src/util/slugify.ts
const str = '# [ topic ][ color ]';
const slug = encodeURI(
str.trim()
.replace(/\s+/g, "-") // Replace whitespace with -
.replace(/[\]\[\!\'\#\$\%\&\'\(\)\*\+\,\.\/\:\;\<\=\>\?\#\\\^\_\{\|\}\~\`。,、;:?!…—·ˉ¨‘’“”々~‖∶"'`|〃〔〕〈〉《》「」『』.〖〗【】()[]{}]/g, "") // Remove known punctuators
.replace(/^\-+/, "") // Remove leading -
.replace(/\-+$/, "") // Remove trailing -
);
console.log(slug) // "topic--color"

jsdoc how break/close a tag

I would like insert a description between two example
/**
*#method ChangeItem
*#example
*oMenu.ChangeItem("menu.enable_all",{enable:true});
*oMenu.ChangeItem("menu",label:"",icon:align:"after",text:ICO.arrow_down}});
*
*If I write description here, it appear into the first example
*
*#example
*oMenu.ChangeItem("menu.enable_all",{enable:true});
*oMenu.ChangeItem("menu",{label:"",icon:{align:"after",text:ICO.arrow_down}});
*/
How can I close the first tag?
I tried to use the tag description but it go on the top of the first example
Sorry for my english and for the stupid question
I don't think it can be done like that, I have not tried but you could put #description in front of your description (but this might not put your description in the right place).
I think the cleaner approach would be to have one #example block where you put code comments like
oMenu.ChangeItem("menu.enable_all",{enable:true});
oMenu.ChangeItem("menu",label:"",icon:align:"after",text:ICO.arrow_down}});
// Example 2
oMenu.ChangeItem("menu.enable_all",{enable:true});
oMenu.ChangeItem("menu",{label:"",icon:{align:"after",text:ICO.arrow_down}});

going to a javascript link with mechanize-firefox

There is a link on a page, and I want to go to it but it just a javascript command. How with mechanize do I go to the link?
<span>abc</span>
Without the page and its HTML and JS one can only guess. Note that the follow_link() methods don't work with JS links. The method below does, but of course I cannot test without the page.
Probably the best bet is to get link(s) as DOM object(s) for the click method
use WWW::Mechanize::Firefox;
# Get to your page with the link(s)
my $link = find_link_dom( text_regex => 'abc' ); # Or use find_all_links_dom()
$link->click();
# $mech->click( { dom => $link } ) # works as well
There are also text and text_contains relevant options (instead of text_regex), along with a number of others. Note that click method will wait, on a list of events, before returning. See for example this recent post. This is critical for pages that take longer to complete.
See docs for find_link_dom() and click methods. They aren't very detailed or rich in examples but do provide enough to play with and figure it out.
If you need to interrogate links use find_all_links_dom(), which returns an array or a reference to array (depending on context) of Firefox's DOM as MozRepl::RemoteObject instances.
my #links_dom = find_all_links_dom( text_contains => 'abc' );
# Example from docs for find_link_dom()
for my $ln (#links_dom) {
print $ln->{innerHTML} . "\n"
}
See the page for MozRepl::RemoteObject to see what you can do with it. If you only need to find out which link to click the options for find_link_dom() should be sifficient.
This has been tested only with a toy page, that uses __doPostBack link, with <span> in the link.

Crossrider: change title of a link

Using crossrider, is it possible to get link object in a dom and change the link's title.
I am creating a plugin that detect malicious site and add [Malicious] in front of the link.
I probably could do this by parsing strings, but if it is supported by DOM, it would make my life so much easier.
Crossrider extensions support the jQuery ($) object and hence you can use it to obtain your link from within the extension.js file, as follows:
appAPI.ready(function ($) {
// Where <linkSel> is the selector for retrieving the link or links you require
$(<linkSel>).text(); // retrieves the text for the specified <linkSel> object
// OR the following to prefix the link's text with '[Malicious] '
$(<linkSel>).text('[Malicious] ' + $(<linkSel>).text());
});