Skip to content

Commit

Permalink
Small fixes to merge-code filter
Browse files Browse the repository at this point in the history
Use promises correctly. This makes the filter actually do something.
  • Loading branch information
noelwelsh committed Jan 23, 2024
1 parent 44ce5c8 commit e5207ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/filters/common/merge-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ function createFilter() {
// treats the top-level Pandoc as a single element
// so we can merge code blocks at the top level -.-
function stdioComplete(action) {
return stdin((json) => {
return stdin().then((json) => {
let data = JSON.parse(json);
data = Object.assign(data, { blocks: mergeAll(data.blocks) });
const format = process.argv.length > 2 ? process.argv[2] : "";
const output = pandoc.filter(data, action, format);
process.stdout.write(JSON.stringify(output));
output.then(out => process.stdout.write(JSON.stringify(out)));
});
}

Expand Down

0 comments on commit e5207ab

Please sign in to comment.