Markdown Tree Test

This is an example for a bug report submitted for the awesome WordPress Markdown plugin WP Githuber MD.

I like using the Linux tree utility to view a visual representation of a directory hierarchy. The output is also useful in documentation. However, the markdown plugin I use (doesn’t everyone like writing blog posts in markdown?) doesn’t render the output correctly by default. The extended characters used to draw the lines are not preserved.

Example image of tree output in the a console:

Actual output when added to the post as a markdown code block:

treetest/
??? dir1
?   ??? file1.1
?   ??? file1.2
??? dir2
    ??? file2.1

However, if a different character set is used, the result is passable. Using tree --charset utf-7 treetest or tree --charset ascii treetest, the result is:

treetest
|-- dir1
|   |-- file1.1
|   `-- file1.2
`-- dir2
    `-- file2.1

The result is not quite as nice, but sufficient. If the issue is resolved, I will update this post.