Skip to content
Permalink
Browse files
fix(embed): run processor properly on embedded files
fixes #17
  • Loading branch information
raineszm committed Feb 10, 2021
1 parent ef20c37 commit f75f82316fbd1e608e0c8351f511bc46497efff6
Showing with 4 additions and 2 deletions.
  1. +2 −1 src/embed.ts
  2. +2 −1 src/labels.ts
@@ -127,7 +127,8 @@ class EmbedResolver {
this.parentFile.info(`Parsing "${embedTarget}"`, this.node);

const embedFile = makeVFile(data, file.path, subpath);
const processed = this.processor.parse(embedFile);
const node = this.processor.parse(embedFile);
const processed = await this.processor.run(node, embedFile);
this.parentFile.messages.push(...embedFile.messages);

return processed;
@@ -34,7 +34,8 @@ function addLabel(
): void {
visit(tree, ['heading', 'textDirective'], (node: Node) => {
if (!isHeading(node) && !isLabelDirective(node)) {
throw new Error(`node of type ${node.type} cannot be labeled`);
file.message(`node of type ${node.type} cannot be labeled`);
return;
}
const namedFile = toNamedVFile(file);
const { subpath, type } = getLabel(node);

0 comments on commit f75f823

Please sign in to comment.