@markdoc/markdoc
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -46,2 +46,3 @@ import Ast from './src/ast'; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -58,2 +59,3 @@ }>>, string>; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -70,2 +72,3 @@ }>>, string>; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -82,2 +85,3 @@ }>>, string>; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -94,2 +98,3 @@ }>>, string>; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -128,2 +133,3 @@ }>>, string>; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -155,2 +161,3 @@ }>>): any; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -157,0 +164,0 @@ }>>; |
@@ -21,2 +21,3 @@ import Node from './node'; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -23,0 +24,0 @@ }>>): any; |
@@ -11,2 +11,3 @@ declare const _default: { | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -23,2 +24,3 @@ }>>, string>; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -35,2 +37,3 @@ }>>, string>; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -47,2 +50,3 @@ }>>, string>; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -59,2 +63,3 @@ }>>, string>; | ||
validateFunctions?: boolean | undefined; | ||
environment?: string | undefined; | ||
} | undefined; | ||
@@ -61,0 +66,0 @@ }>>, string>; |
@@ -28,2 +28,3 @@ import type Func from './ast/function'; | ||
validateFunctions?: boolean; | ||
environment?: string; | ||
}; | ||
@@ -110,3 +111,4 @@ }>; | ||
slots?: boolean; | ||
location?: boolean; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@markdoc/markdoc", | ||
"author": "Ryan Paul", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "A text markup language for documentation", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
@@ -54,2 +54,22 @@ // @ts-check | ||
}); | ||
it('location off', function () { | ||
const example = convert(`# This is a test`, { | ||
file: 'foo.md', | ||
location: false, | ||
}); | ||
expect(example.children[0].location).toBeUndefined(); | ||
}); | ||
it('location on', function () { | ||
const example = convert(`# This is a test`, { | ||
file: 'foo.md', | ||
location: true, | ||
}); | ||
const expected = { file: 'foo.md', start: { line: 0 }, end: { line: 1 } }; | ||
expect(example.children[0].location).toDeepEqualSubset(expected); | ||
const example2 = convert(`# This is a test`, { file: 'foo.md' }); | ||
expect(example2.children[0].location).toDeepEqualSubset(expected); | ||
}); | ||
}); | ||
@@ -56,0 +76,0 @@ |
@@ -104,2 +104,3 @@ import Node from './ast/node'; | ||
handleSlots?: boolean, | ||
addLocation?: boolean, | ||
inlineParent?: Node | ||
@@ -154,14 +155,16 @@ ) { | ||
node.errors = errors; | ||
node.lines = token.map || parent.lines || []; | ||
node.location = { | ||
file, | ||
start: { | ||
line: node.lines[0], | ||
character: position.start, | ||
}, | ||
end: { | ||
line: node.lines[1], | ||
character: position.end, | ||
}, | ||
}; | ||
if (addLocation !== false) { | ||
node.lines = token.map || parent.lines || []; | ||
node.location = { | ||
file, | ||
start: { | ||
line: node.lines[0], | ||
character: position.start, | ||
}, | ||
end: { | ||
line: node.lines[1], | ||
character: position.end, | ||
}, | ||
}; | ||
} | ||
@@ -192,3 +195,3 @@ if (inlineParent) node.inline = true; | ||
for (const child of token.children) | ||
handleToken(child, nodes, file, handleSlots, inlineParent); | ||
handleToken(child, nodes, file, handleSlots, addLocation, inlineParent); | ||
} | ||
@@ -206,3 +209,3 @@ | ||
for (const token of tokens) | ||
handleToken(token, nodes, args?.file, args?.slots); | ||
handleToken(token, nodes, args?.file, args?.slots, args?.location); | ||
@@ -209,0 +212,0 @@ if (nodes.length > 1) |
@@ -34,2 +34,3 @@ import type Func from './ast/function'; | ||
validateFunctions?: boolean; | ||
environment?: string; | ||
}; | ||
@@ -172,2 +173,3 @@ }>; | ||
slots?: boolean; | ||
location?: boolean; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1892904
25819