Skip to content

Commit

Permalink
Merge pull request #174 from marcellamaki/anchor-links
Browse files Browse the repository at this point in the history
Add anchor links to individual glossary terms
  • Loading branch information
indirectlylit authored Feb 23, 2021
2 parents 53fcbb3 + 8a1051f commit 4a2ae39
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion docs/pages/glossary/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
</thead>
<tbody>
<tr v-for="(term, i) in visibleTerms" :key="i">
<th>{{ term.term }}</th>
<th>
{{ term.term }}
<DocsAnchorTarget
:anchor="anchor(term)"
/>
</th>
<td><em>{{ term.note }}</em></td>
<td>{{ term.description }}</td>
</tr>
Expand Down Expand Up @@ -75,6 +80,18 @@
return termList(this.filterText);
},
},
methods: {
anchor(term) {
// standarize url
return `#${term.term
.toLowerCase()
.split(' ')
.join('_')
.replace('(', '')
.replace(')', '')
.replace(',', '')}`;
},
},
};
</script>
Expand Down

0 comments on commit 4a2ae39

Please sign in to comment.