Skip to content

Commit

Permalink
Generate better anchors in iron-doc-module.
Browse files Browse the repository at this point in the history
For example:

```js
export class Foo {
  bar() {}
}
```

Documentation for this will generate anchors like:

`#Foo`
`#Foo-method-bar`

Part of addressing Polymer/old-docs-site#2541
  • Loading branch information
rictic committed May 2, 2018
1 parent 216ec12 commit b41ad9e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions iron-doc-module.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ <h2>
<template is="dom-repeat" items="[[descriptor.elements]]" sort="_compareDescriptors">
<iron-doc-element
descriptor="[[item]]"
anchor-id="[[fragmentPrefix]]element-[[item.name]]">
anchor-id="[[fragmentPrefix]][[item.name]]"
fragment-prefix="[[fragmentPrefix]][[item.name]]-">
</iron-doc-element>
</template>
</section>
Expand All @@ -65,7 +66,8 @@ <h2>
<template is="dom-repeat" items="[[descriptor.classes]]" sort="_compareDescriptors">
<iron-doc-class
descriptor="{{item}}"
anchor-id="[[fragmentPrefix]]class-[[item.name]]">
anchor-id="[[fragmentPrefix]][[item.name]]"
fragment-prefix="[[fragmentPrefix]][[item.name]]-">
</iron-doc-summary>
</template>
</section>
Expand All @@ -75,7 +77,8 @@ <h2>
<template is="dom-repeat" items="[[descriptor.mixins]]" sort="_compareDescriptors">
<iron-doc-mixin
descriptor="[[item]]"
anchor-id="[[fragmentPrefix]]mixin-[[item.name]]">
anchor-id="[[fragmentPrefix]][[item.name]]"
fragment-prefix="[[fragmentPrefix]][[item.name]]-">
</iron-doc-mixin>
</template>
</section>
Expand All @@ -85,7 +88,8 @@ <h2>
<template is="dom-repeat" items="[[_getPolymerBehaviors(descriptor)]]" sort="_compareDescriptors">
<iron-doc-behavior
descriptor="[[item]]"
anchor-id="[[fragmentPrefix]]behavior-[[item.name]]">
anchor-id="[[fragmentPrefix]][[item.name]]"
fragment-prefix="[[fragmentPrefix]][[item.name]]-">
</iron-doc-summary>
</template>
</section>
Expand All @@ -99,7 +103,7 @@ <h2>
</h2>
<template is="dom-repeat" items="[[descriptor.functions]]" sort="_compareDescriptors">
<iron-doc-function
anchor-id="[[fragmentPrefix]]function-[[item.name]]"
anchor-id="[[fragmentPrefix]][[item.name]]"
descriptor="[[item]]">
</iron-doc-function>
</template>
Expand Down

0 comments on commit b41ad9e

Please sign in to comment.