A good coding style can help us have clear ideas when making web pages, and the code comments also have some small knowledge.
I summarized the annotation writing standards I used in my work. In fact, there is no technical content. The main thing is to pay attention to the standards, which facilitates the unified production method and facilitates maintenance.
These experiences include four parts: "Region Comments", "Single Line Comments", "Comment Levels" and "Assisted Comments". The method of area annotation used by most friends will start with "annotation content" or "annotation content end", "start" or "end", etc. In comparison, starting with "S" or "E" can be faster. To use, for example, just write the start or end comment once, then copy it, and change the "S" or "E" to quickly complete the comment in the area.
In actual work, it is sometimes unclear whether the annotation should be above or below the label. In order to avoid this situation, the annotation information is uniformly written before and after the beginning and end of the region label, and is preceded by "S" or
"
E" starts, indicating the beginning or end of the area annotation.
Example:
<!--=S comment content-->
<div>
...
</div>
<!--=E Comment content-->
/*=S Comment content*/
.class{
...
}
.class{
...
}
/*=E Comment content*/
Single-line comment
comment information should be written in the content area that needs to be commented.
Example:
<div>
<!--Comment content-->
...
</div>
.class{
/*Comment content*/
...
}
Annotation level
In module production, there may be areas within areas. In order to better distinguish the levels between areas, the concept of annotation level is introduced. The equal sign in front of the area comment indicates the level of the current comment.
Example:
<!--=S comment content-->
...
<!--==S Comment content-->
...
<!--===S Comment content-->
...
<!--===E Comment content-->
...
<!--==E Comment content-->
...
<!--=E Comment content-->
/*=S Comment content*/
...
/*==S Comment content*/
...
/*===S comment content*/
...
/*===E Comment content*/
...
/*==E Comment content*/
...
/*=E Comment content*/
Assist in commenting
identification information such as modification time and modifier added when maintained by non-authors. Add the modifier and modification time and other information based on the area comment or single-line comment.
Example (region comment):
<!--==S comment content [modifier and modification time]-->
<div>
...
</div>
<!--==E Comment content [modifier and modification time]-->
/*=S Comment content [modifier and modification time]*/
.class{
...
}
.class{
...
}
/*=E Comment content [modifier and modification time]*/
Example (single line comment):
<div>
<!-- Comment content [modifier and modification time]-->
...
</div>
.class{
/*Comment content [modifier and modification time]*/
...
}