Skip to content

Commit 4d45846

Browse files
authored
fix: replace Form N headings with function signatures matching jQuery API style
Replace unclear "Form 1", "Form 2", "Form 3" headings with descriptive function signatures (e.g., `required()`, `required( dependency-expression )`) styled with gray background headers and light body blocks to match the original jQuery API documentation layout. Files changed: - _layouts/default.html: add .signature and .signature-body CSS classes - _entries/required-method.md: 3 signature forms - _entries/rules.md: 3 signature forms - _entries/jQuery.validator.addClassRules.md: 2 signature forms
1 parent 3bae523 commit 4d45846

4 files changed

Lines changed: 69 additions & 14 deletions

File tree

_entries/jQuery.validator.addClassRules.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ Add a compound class method - useful to refactor common combinations of rules in
1313

1414
## Usage
1515

16-
### Form 1
16+
### `jQuery.validator.addClassRules( name, rules )`
17+
{:.signature}
18+
19+
<div class="signature-body" markdown="1">
1720

1821
**name** *(String)*
1922

@@ -23,12 +26,19 @@ The name of the class rule to add
2326

2427
The compound rules (see example)
2528

26-
### Form 2
29+
</div>
30+
31+
### `jQuery.validator.addClassRules( rules )`
32+
{:.signature}
33+
34+
<div class="signature-body" markdown="1">
2735

2836
**rules** *(Object)*
2937

3038
A map of className-rules pairs (see example).
3139

40+
</div>
41+
3242
## Examples
3343

3444
### Example 1

_entries/required-method.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,37 @@ Return false, if the element is empty (text input) or unchecked (radio/checkbox)
1717

1818
## Usage
1919

20-
### Form 1
20+
### `required()`
21+
{:.signature}
2122

22-
The element is always required.
23+
<div class="signature-body" markdown="1">
2324

24-
### Form 2
25+
This signature does not accept any arguments.
2526

26-
Makes the element required, depending on the result of the given expression.
27+
</div>
28+
29+
### `required( dependency-expression )`
30+
{:.signature}
31+
32+
<div class="signature-body" markdown="1">
2733

2834
**dependency-expression** *(String)*
2935

3036
An expression (String) that is evaluated in the context of the element's form, making the field required only if the expression returns more than one element. Very often your expression will use selector filters such as `#foo:checked`, `#foo:filled`, `#foo:visible`. This plugin provides [custom selectors for that purpose](/documentation#custom-selectors).
3137

32-
### Form 3
38+
</div>
3339

34-
Makes the element required, depending on the result of the given callback.
40+
### `required( dependency-callback )`
41+
{:.signature}
42+
43+
<div class="signature-body" markdown="1">
3544

3645
**dependency-callback** *(Function)*
3746

3847
The function is executed with the element as it's only argument: If it returns true, the element is required.
3948

49+
</div>
50+
4051
## Examples
4152

4253
### Example 1

_entries/rules.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,41 @@ Returns the validations rules for the first selected element or Adds the specifi
1717

1818
## Usage
1919

20-
### Form 1
20+
### `.rules()`
21+
{:.signature}
2122

22-
Read rules for the first element
23+
<div class="signature-body" markdown="1">
2324

24-
### Form 2
25+
Returns the validation rules for the first selected element.
2526

26-
Add rules
27+
</div>
28+
29+
### `.rules( "add", rules )`
30+
{:.signature}
31+
32+
<div class="signature-body" markdown="1">
2733

2834
**"add"** *(String)*
2935

3036
**rules** *(Object)*
3137

3238
The rules to add. Accepts the same format as the rules-option of the validate-method.
3339

34-
### Form 3
40+
</div>
3541

36-
Remove rules
42+
### `.rules( "remove", rules )`
43+
{:.signature}
44+
45+
<div class="signature-body" markdown="1">
3746

3847
**"remove"** *(String)*
3948

4049
**rules** *(Object)*
4150

4251
The space-seperated names of rules to remove and return. If left unspecified, removes and returns all rules. Manipulates only rules specified via rules-option or via rules("add").
4352

53+
</div>
54+
4455
## Examples
4556

4657
### Example 1

_layouts/default.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,29 @@
134134
iframe {
135135
max-width: 100%;
136136
}
137+
/* Function signature headers – styled to match the original jQuery API docs */
138+
.signature {
139+
background-color: #808080;
140+
color: #fff;
141+
padding: 8px 12px;
142+
font-size: 1em;
143+
font-weight: bold;
144+
border-radius: 3px;
145+
margin-top: 1.5em;
146+
}
147+
.signature code {
148+
background-color: transparent;
149+
color: #fff;
150+
font-size: 1em;
151+
padding: 0;
152+
}
153+
/* Content block beneath a signature header */
154+
.signature-body {
155+
background-color: #f0f0f0;
156+
border-left: 4px solid #808080;
157+
padding: 12px 16px;
158+
margin-bottom: 1.5em;
159+
}
137160
</style>
138161
</head>
139162
<body>

0 commit comments

Comments
 (0)