Skip to content

Commit

Permalink
Merge pull request #33 from pzuraq/add-is-heading
Browse files Browse the repository at this point in the history
[FEAT] Adds is_heading so items can specify that they are headings
  • Loading branch information
mansona authored Dec 21, 2019
2 parents a16df2c + 0d3d90f commit 295a95b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const TableOfContentsSerializer = new Serializer('page', {
'title',
'pages',
'skip_toc',
'is_heading',
],
keyForAttribute: 'cammelcase',
});
Expand Down
13 changes: 13 additions & 0 deletions test/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ id: face
input.write({
'index.md': '# Hello world',
'pages.yml': `
- title: "Introduction
url: 'toc-heading-introduction'
is_heading: true
- title: "Guides and Tutorials"
url: 'index'
skip_toc: true
Expand Down Expand Up @@ -226,6 +230,15 @@ id: face

expect(folderOutput.content).to.have.property('index.json');

expect(JSON.parse(folderOutput.content['pages.json']).data).to.deep.include({
type: 'pages',
id: 'toc-heading-introduction',
attributes: {
title: 'Introduction',
'is-heading': true,
},
});

expect(JSON.parse(folderOutput.content['pages.json']).data).to.deep.include({
type: 'pages',
id: 'index',
Expand Down

0 comments on commit 295a95b

Please sign in to comment.