Skip to content

Commit fb0a27f

Browse files
irgendwrtmcw
authored andcommitted
fix(default theme): only render either note or section (fixes #1113) (#1206)
* fix(default theme): only render either note or section Fixes notes also showing up as duplicate sections. fix #1113 * undo revertion of c5f32ae * update test snapshot
1 parent c5f32ae commit fb0a27f

File tree

3 files changed

+9
-58
lines changed

3 files changed

+9
-58
lines changed

__tests__/__snapshots__/test.js.snap

+7-54
Original file line numberDiff line numberDiff line change
@@ -1616,10 +1616,7 @@ exports[`html nested.input.js 1`] = `
16161616

16171617
<p>Creates a new Klass</p>
16181618

1619-
1620-
16211619
<div class='pre p1 fill-light mt0'>new Klass(foo: any)</div>
1622-
16231620

16241621

16251622
<p>
@@ -1680,10 +1677,7 @@ exports[`html nested.input.js 1`] = `
16801677
This is a [klasssic]<a href=\\"#klass\\">Klass</a>
16811678
This is a [link to something that does not exist]<a href=\\"DoesNot\\">DoesNot</a></p>
16821679

1683-
1684-
16851680
<div class='pre p1 fill-light mt0'>isClass(other: <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object\\">Object</a>, also: any): <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean\\">boolean</a></div>
1686-
16871681

16881682

16891683

@@ -1758,10 +1752,7 @@ This is a [link to something that does not exist]<a href=\\"DoesNot\\">DoesNot</
17581752
<p>A function that triggers the case where the autolinker doesn't find
17591753
the referenced class type</p>
17601754

1761-
1762-
17631755
<div class='pre p1 fill-light mt0'>isWeird(other: Weird): <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean\\">boolean</a></div>
1764-
17651756

17661757

17671758

@@ -1827,10 +1818,7 @@ the referenced class type</p>
18271818

18281819
<p>This method takes a Buffer object that will be linked to nodejs.org</p>
18291820

1830-
1831-
18321821
<div class='pre p1 fill-light mt0'>isBuffer(buf: (<a href=\\"https://nodejs.org/api/buffer.html\\">Buffer</a> | <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String\\">string</a>), size: <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\\">number</a>): <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean\\">boolean</a></div>
1833-
18341822

18351823

18361824

@@ -1906,10 +1894,7 @@ the referenced class type</p>
19061894

19071895
<p>This method takes an array of buffers and counts them</p>
19081896

1909-
1910-
19111897
<div class='pre p1 fill-light mt0'>isArrayOfBuffers(buffers: <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array\\">Array</a>&#x3C;<a href=\\"https://nodejs.org/api/buffer.html\\">Buffer</a>>): <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\\">number</a></div>
1912-
19131898

19141899

19151900

@@ -1983,10 +1968,7 @@ k.isArrayOfBuffers();</pre>
19831968

19841969
<p>A magic number that identifies this Klass.</p>
19851970

1986-
1987-
19881971
<div class='pre p1 fill-light mt0'>MAGIC_NUMBER</div>
1989-
19901972

19911973

19921974

@@ -2039,10 +2021,7 @@ k.isArrayOfBuffers();</pre>
20392021

20402022
<p>Get this Klass's foo</p>
20412023

2042-
2043-
20442024
<div class='pre p1 fill-light mt0'>getFoo(): <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\\">Number</a></div>
2045-
20462025

20472026

20482027

@@ -2102,10 +2081,7 @@ k.isArrayOfBuffers();</pre>
21022081

21032082
<p>A function with an options parameter</p>
21042083

2105-
2106-
21072084
<div class='pre p1 fill-light mt0'>withOptions(options: <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object\\">Object</a>, otherOptions: <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\\">number</a>?)</div>
2108-
21092085

21102086

21112087

@@ -2203,10 +2179,7 @@ k.isArrayOfBuffers();</pre>
22032179

22042180
<p>A function with a deep options parameter</p>
22052181

2206-
2207-
22082182
<div class='pre p1 fill-light mt0'>withDeepOptions(options: <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object\\">Object</a>)</div>
2209-
22102183

22112184

22122185

@@ -2314,10 +2287,7 @@ k.isArrayOfBuffers();</pre>
23142287

23152288
<p>Klass event</p>
23162289

2317-
2318-
23192290
<div class='pre p1 fill-light mt0'>event</div>
2320-
23212291

23222292

23232293

@@ -2353,6 +2323,7 @@ k.isArrayOfBuffers();</pre>
23532323

23542324
</section>
23552325

2326+
23562327

23572328

23582329
<section class='p2 mb2 clearfix bg-white minishadow'>
@@ -2370,10 +2341,7 @@ k.isArrayOfBuffers();</pre>
23702341

23712342
<p>a typedef with nested properties</p>
23722343

2373-
2374-
23752344
<div class='pre p1 fill-light mt0'>CustomError</div>
2376-
23772345

23782346

23792347

@@ -2427,6 +2395,7 @@ k.isArrayOfBuffers();</pre>
24272395

24282396
</section>
24292397

2398+
24302399

24312400

24322401
<section class='p2 mb2 clearfix bg-white minishadow'>
@@ -2446,10 +2415,7 @@ k.isArrayOfBuffers();</pre>
24462415
a <a href=\\"#klass\\">klass instance multiword</a>,
24472416
like a <a href=\\"#klass\\">klass</a></p>
24482417

2449-
2450-
24512418
<div class='pre p1 fill-light mt0'>bar(): <a href=\\"#klass\\">Klass</a></div>
2452-
24532419

24542420

24552421

@@ -2485,6 +2451,7 @@ like a <a href=\\"#klass\\">klass</a></p>
24852451

24862452
</section>
24872453

2454+
24882455

24892456

24902457
<section class='p2 mb2 clearfix bg-white minishadow'>
@@ -2502,10 +2469,7 @@ like a <a href=\\"#klass\\">klass</a></p>
25022469

25032470
<p>Rest property function</p>
25042471

2505-
2506-
25072472
<div class='pre p1 fill-light mt0'>bar(toys: ...<a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\\">Number</a>): <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined\\">undefined</a></div>
2508-
25092473

25102474

25112475

@@ -2554,6 +2518,7 @@ like a <a href=\\"#klass\\">klass</a></p>
25542518

25552519
</section>
25562520

2521+
25572522

25582523

25592524
<section class='p2 mb2 clearfix bg-white minishadow'>
@@ -2573,10 +2538,7 @@ like a <a href=\\"#klass\\">klass</a></p>
25732538
a <a href=\\"#klass\\">klass instance multiword</a>,
25742539
like a <a href=\\"#klass\\">klass</a>. This needs a <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\\">number</a> input.</p>
25752540

2576-
2577-
25782541
<div class='pre p1 fill-light mt0'>bar(): <a href=\\"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined\\">undefined</a></div>
2579-
25802542

25812543

25822544

@@ -2612,6 +2574,7 @@ like a <a href=\\"#klass\\">klass</a>. This needs a <a href=\\"https://developer
26122574

26132575
</section>
26142576

2577+
26152578

26162579

26172580
<section class='p2 mb2 clearfix bg-white minishadow'>
@@ -2629,10 +2592,7 @@ like a <a href=\\"#klass\\">klass</a>. This needs a <a href=\\"https://developer
26292592

26302593
<p>This is Foo</p>
26312594

2632-
2633-
26342595
<div class='pre p1 fill-light mt0'>new Foo()</div>
2635-
26362596

26372597

26382598

@@ -2673,10 +2633,7 @@ like a <a href=\\"#klass\\">klass</a>. This needs a <a href=\\"https://developer
26732633

26742634
<p>This is bar</p>
26752635

2676-
2677-
26782636
<div class='pre p1 fill-light mt0'>bar</div>
2679-
26802637

26812638

26822639

@@ -2714,6 +2671,7 @@ like a <a href=\\"#klass\\">klass</a>. This needs a <a href=\\"https://developer
27142671

27152672
</section>
27162673

2674+
27172675

27182676

27192677
<section class='p2 mb2 clearfix bg-white minishadow'>
@@ -2731,10 +2689,7 @@ like a <a href=\\"#klass\\">klass</a>. This needs a <a href=\\"https://developer
27312689

27322690
<p>I am the container of stream types</p>
27332691

2734-
2735-
27362692
<div class='pre p1 fill-light mt0'>customStreams</div>
2737-
27382693

27392694

27402695

@@ -2773,10 +2728,7 @@ like a <a href=\\"#klass\\">klass</a>. This needs a <a href=\\"https://developer
27732728

27742729
<p>I am a passthrough stream that belongs to customStreams</p>
27752730

2776-
2777-
27782731
<div class='pre p1 fill-light mt0'>new passthrough()</div>
2779-
27802732

27812733

27822734

@@ -2816,6 +2768,7 @@ like a <a href=\\"#klass\\">klass</a>. This needs a <a href=\\"https://developer
28162768

28172769
</section>
28182770

2771+
28192772

28202773
</div>
28212774
</div>

src/default_theme/index._

+2-1
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,14 @@
9696
<% docs.forEach(function(s) { %>
9797
<% if (s.kind === 'note') { %>
9898
<div class='keyline-top-not py2'><%=renderNote({ note: s })%></div>
99-
<% } %>
99+
<% } else { %>
100100
<%= renderSection({
101101
section: s,
102102
renderSection: renderSection,
103103
renderSectionList: renderSectionList,
104104
renderParamProperty: renderParamProperty
105105
}) %>
106+
<% } %>
106107
<% }) %>
107108
</div>
108109
</div>

src/default_theme/section._

-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
<% } %>
1717

1818
<%= md(section.description) %>
19-
20-
<% if (section.kind !== "note") { %>
2119
<div class='pre p1 fill-light mt0'><%= signature(section) %></div>
22-
<% } %>
2320
<% if (section.type) { %>
2421
<p>
2522
Type:

0 commit comments

Comments
 (0)