Skip to content

Commit

Permalink
Add support for numbering in heading as used at adr-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Nov 22, 2017
1 parent ea5dbe5 commit 0336e2d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ We refer to [GitHub issues](https://github.com/adr/adr-log/issues) by using `#NU

## [unreleased]

### Added

- Add support for numbering in heading as used at [adr-tools](https://github.com/npryce/adr-tools):
They are removed when generating the log.
Fixes [#23](https://github.com/adr/adr-log/issues/23).

### Changed

- Really using the format of "Keep a Changelog": Versions are indicated without prefix `v`.
Expand Down
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ toc.insertAdrToc = require('./lib/insert').insertAdrToc;
/**
* Generate a markdown table of contents. This is the
* function that does all of the main work with Remarkable.
*
* This is the core implementation. Here, the file contents (docs/adr/dddd-*.md) are parsed and transformed into markdown.
*/
function generate() {
return function(md) {
Expand Down Expand Up @@ -68,8 +70,10 @@ function generate() {
}

const newline = utils.determineNewline(content);
const title = content.split(newline)[0].substr(2);
console.log(title);
var title = content.split(newline)[0].substr(2);
console.log("title before decimal removal: ", title);
title = title.replace(/^\d+\. /, '');
console.log("title after decimal removal: ", title);
res.content += `- [ADR-${numb[0].trim()}](${token.content}) - ${title + newline}`
}
res.content = res.content.trim();
Expand Down

0 comments on commit 0336e2d

Please sign in to comment.