doorstop
doorstop copied to clipboard
Piping published markdown to pandoc includes "building tree..."
Following the suggestion in #166 to pipe published output to pandoc, I'm using the command:
doorstop publish --markdown --no-levels body PREFIX | pandoc -t docx -o PREFIX.docx
But doorstop includes the "building tree..." status output along with the generated markdown, so pandoc includes it in the first line.
That is, in my docx file, I get on the first line, as body text:
building tree… # 1.0 My first heading
when it should be, in Heading 1 style:
1.0 My first heading
I also tried using the --quiet
option, but then the publish command outputs nothing.
As a workaround, use a temporary .md file:
$> doorstop publish --markdown --no-levels body PREFIX PREFIX.md
$> pandoc -t docx PREFIX.md -o PREFIX.docx
Thanks for the report! There's at least two bugs here:
-
doorstop publish
should write tostdout
and the progress message tostderr
-
--quiet
should not silencestdout
fromdoorstop publish
I thought I'd try potential bug 1 and figure out where the write of "building tree..." is coming from for doorstop publish
.
I didn't find it, but I did discover that if you do the original command with a verbose option, then the output comes out correctly.
$> doorstop publish -v --markdown --no-levels body PREFIX | pandoc -t docx -o PREFIX.docx
Maybe something to do with logging levels?
I'm pretty sure this is the line you're looking for: https://github.com/jacebrowning/doorstop/blob/0353d4bd3d5cc138895025c32018d02937a4d4e4/doorstop/cli/commands.py#L545
utilities.show()
is using print()
(stdout), while logging writes to stderr.