doorstop icon indicating copy to clipboard operation
doorstop copied to clipboard

Piping published markdown to pandoc includes "building tree..."

Open JustinW80 opened this issue 6 years ago • 3 comments

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

JustinW80 avatar May 22 '18 17:05 JustinW80

Thanks for the report! There's at least two bugs here:

  1. doorstop publish should write to stdout and the progress message to stderr
  2. --quiet should not silence stdout from doorstop publish

jacebrowning avatar May 22 '18 17:05 jacebrowning

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?

JustinW80 avatar Mar 29 '19 03:03 JustinW80

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.

jacebrowning avatar Mar 29 '19 12:03 jacebrowning