jsdoc how break/close a tag - tags

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}});

Related

What is the shortcut to insert multiple line comment with * in the beginning in VS Code?

I know the shortcut Ctrl+shift+A in VS Code Linux to insert the multiple lines comment, but it just insert like this:
/*
my comment
my code i want to hide
etc
*/
How to get a comment like this?
/**
* my comment
* my code i want to hide
* etc
*/
If I want to get comment like above, I need to insert manually like this
/**
*/
And every time I hit "Enter" inside that comment, VS Code automatically insert * like this
/**
*
*
*
*
*
*/
It looks like that kind of comment is supported in VS Code,
But I dont know the short cut to insert the new one without typing manually.
Anyone know the answer ? Thanks,
UPDATE : VS CODE has update about this, more info : https://code.visualstudio.com/docs/languages/javascript#_jsdoc-support
When you type /** VS code will know what you want and show like this
hit enter and move your code inside that comment block
Look like there is no shortcut key for this till now, and if we want to that kind of comment style, we need to do it manually by typing this:
/**
*/
and hit "Enter" inside that comment

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.
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

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"

Doxygen Highlight Parameter in Pre-condition

I have a doxygen header for a function as follows:
/** Some description.
#param[in] grid1 First grid
#param[in] grid2 Second grid
#pre grid1 and grid2 must be of the same dimensions
*/
I'd like grid1 and grid2 to be specially highlighted in the pre-conditions section of the generated documentations, since they are parameters. In my mind, I should be able to do something like
#pre #grid1 and #grid2 must be the same size
But this doesn't work.
Any thoughts on how to achieve this?
It would be nice if # automatically linked to the function argument definition. However, I can't see anyway of doing this in the automatic link generation section of the doxygen manual.
Having looked at the documentation HTML source it seems that parameters seem to be simply styled as strong and with the class paramname. So something like
#pre <strong class="paramname">grid1</strong> and
<strong class="paramname">grid2</strong> must be the same size.
should give you the results you want. Clearly this is overly verbose to write out each time. However, you should be able to define a custom command, say \paramname, to do this so you could just write
#pre \paramname{grid1} and \paramname{grid2} must be the same size.
Edit: This can be achieved with the configuration file alias
ALIASES += paramname{1}="<strong class="paramname">\1</strong>"
Landed here looking for the answer, but found it elsewhere.
Use \p to indicate that the next word is a function parameter.
And, of course, you can use # instead of \.
/** Some description.
#param[in] grid1 First grid
#param[in] grid2 Second grid
#pre #p grid1 and #p grid2 must be of the same dimensions
*/
See Doxygen Special Commands reference.

Zend Framework Filter Input StripTags and "<3"

I'm currently using Zend_Filter_StripTags in a commenting system, but stuff kinda breaks when '<3' is entered. StripTags doesn't seem to be smart enough to realize that it's not an HTML tag, and creating the filter as "new Zend_Filter_StripTags(array('3'))" doesn't seem to work either.
Should I pass the input through a regexp first, or is there a way to get Zend_Filter_StripTags to straighten up and fly right?
Ended up writing a Zend_Filter class that was basically a wrapper for HTMLPurifier. Works perfectly, because HTMLPurifier is a LOT smarter than striptags.
I'm not familiar with Zend much, but if you want stuff like <3 to be allowed, just do htmlspecialchars instead of strip_tags on it.
What you want is Zend_Filter_HtmlEntites most likely.
See: Zend_Filter_HtmlEnties
The problem with htmlspecialchars and Zend_Filter_HtmlEntities is that if you're trying to strip out all html tags ( like 'a' and 'img', etc ), then instead of stripping them, you end up with that markup in your output.
Take comments on a blog for example. If you use htmlspecialchars or Zend_Filter_HtmlEntities, in a comment where someone tries to use html to enter a link you end up with that markup showing up when you display the comment. But if you use strip_tags or Zend_Filter_StripTags you end up mangling the comment, as neither is smart enough to realize that '<3' isn't a tag, and just strips everything from '<3' until the end of the comment ( or until it finds '>' ).
It would be nice if Zend had something like HTMLPurifier, where it actually checks and validates the input before stripping tags. This means that stuff like '<3' gets left alone, where as stuff like 'Awesome Site' becomes 'Awesome Site'.
This is a problem I'm trying to work around, and at the moment it seems like I'm going to end up writing my own Zend_Filter class that's basically a wrapper for HTMLPurifier.