Skip to content

Commit

Permalink
Auto-merge for PR #813 via VersionBot
Browse files Browse the repository at this point in the history
Properly generate consistent working anchors for both our md output & resin docs
  • Loading branch information
resin-io-versionbot[bot] authored Mar 15, 2018
2 parents 5625326 + a036803 commit 76a8b4d
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 110 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).

## v7.0.4 - 2018-03-15

* Generate consistent working anchors for both our md output & resin docs #813 [Tim Perry]

## v7.0.3 - 2018-03-15

* Fix getting window size when there’s no TTY attached #812 [Akis Kesoglou]
Expand Down
11 changes: 7 additions & 4 deletions automation/capitanodoc/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import * as utils from './utils';
import { Document, Category, Command } from './doc-types';

export function renderCommand(command: Command) {
let result = `## ${ent.encode(command.signature)}\n\n${command.help}\n`;
let result = `## <a name="${getAnchor(command)}"></a>${ent.encode(
command.signature,
)}\n\n${command.help}\n`;

if (!_.isEmpty(command.options)) {
result += '\n### Options';
Expand Down Expand Up @@ -36,11 +38,12 @@ function getAnchor(command: Command) {
'#' +
command.signature
.replace(/\s/g, '-')
.replace(/</g, '60-')
.replace(/>/g, '-62-')
.replace(/\[/g, '')
.replace(/</g, '-')
.replace(/>/g, '-')
.replace(/\[/g, '-')
.replace(/\]/g, '-')
.replace(/--/g, '-')
.replace(/-$/, '')
.replace(/\.\.\./g, '')
.replace(/\|/g, '')
.toLowerCase()
Expand Down
Loading

0 comments on commit 76a8b4d

Please sign in to comment.