canvas-native
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -76,3 +76,3 @@ export function convert(native) { | ||
if (typeof line.level === 'number') { | ||
if (line.isNesting) { | ||
group.meta = { level: line.level }; | ||
@@ -99,3 +99,3 @@ } | ||
if (typeof line.level === 'number') { | ||
if (line.isNesting) { | ||
return sameType && line.level === getNodeLevel(node); | ||
@@ -110,3 +110,3 @@ } | ||
if (typeof line.level !== 'number') { | ||
if (!line.isNesting) { | ||
return false; | ||
@@ -113,0 +113,0 @@ } |
@@ -10,2 +10,6 @@ export default class Type { | ||
get isNesting() { | ||
return typeof this.level === 'number' && this.groupType !== 'canvas'; | ||
} | ||
get type() { | ||
@@ -12,0 +16,0 @@ return this.constructor.name; |
{ | ||
"name": "canvas-native", | ||
"description": "Utilities for working with the native Canvas format", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"author": "Jonathan Clem <jonathan@usecanvas.com>", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/usecanvas/canvas-native/issues", |
@@ -67,2 +67,34 @@ import { convert } from '../../../lib/converters/json'; | ||
it('does not nest under headers', () => { | ||
const doc = parse([ | ||
'# Header', | ||
`${wrap('unordered-list-1')}- UL-1-0`, | ||
].join('\n')); | ||
expect(convert(doc).content).to.eql([ | ||
{ | ||
type : 'heading', | ||
meta : { level: 1 }, | ||
content: '# Header', | ||
}, | ||
{ | ||
type : 'unordered-list', | ||
meta : { level: 0 }, | ||
content: [ | ||
{ | ||
type: 'unordered-list', | ||
meta: { level: 1 }, | ||
content: [ | ||
{ | ||
type : 'unordered-list-item', | ||
meta : { level: 1 }, | ||
content: '- UL-1-0' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
]); | ||
}); | ||
it('handles nested lists', () => { | ||
@@ -69,0 +101,0 @@ const doc = parse([ |
81743
2125