sintaxi/harp

markdown table ignores empty cells

capitalaslash opened this issue · 18 comments

If I try to serve the following markdown file I get a pipe in the second column instead of an empty cell

a | b | c
- | - | -
1 |   | 2

I've attached what the code you provided does in an alternative editor. Is my version what you wanted?
screen shot 2018-10-03 at 5 26 37 pm

Please confirm what the issue is, so that I can categorize it and determine how we can assist you.
Thank you for raising your issue!

yes, the picture you posted is the expected behavior.
let me know of any further detail you may need.

@capitalaslash great.

Also if you can tell me about your OS, Browser, Harp CLI, what html pre-compiler you are using, version and anything else you think might be relevant as that's just the basics.

OS: CentOS
browser: chromium
version: 0.28.1

I don't know what you mean with html pre-compiler? I am serving a super simple markdown website with a bunch a pages for local-use only with

NODE_ENV=production harp server <path> --port <port>

@capitalaslash good to know. We are on version 0.29.x now. Can you update and confirm back to me the issue still exists?

What I was referring to was .ejs, .pug or .jade file types. These are HTML (template) based languages that compile into regular HTML dynamically.

I'll look into your issue tonight. Thank you for the update! Have a great day.

oh yes, I'm using https://github.com/techstreams/harp-github-markdown to get a github style formatting, but I tested without it to check if the error was coming from that.

confirmed in 0.29.0

Too bad. Was hoping for a simple fix. This is getting very clear to me and I'll definitely have a good look tonight. Thank you for jumping through those hoops.

@capitalaslash I can't see how the issue is bubbling up. I see it as a non-standard .md using tables. Broadly it's not a supported feature. I'll have to speak with one of the team leads to see if it was our intention to support it. I'll let you know.

@sintaxi thoughts on this? Did we have an intention to support tables with .md?

@misterhtmlcss That could be as simple as changing the configuration in terraform or switching to a different markdown processor. If we are confident marked is the best processor perhaps we can make the config part of the harp public API. It would make for an easy win.

https://github.com/sintaxi/terraform/blob/master/lib/template/processors/md.js#L4

here are the marked configuration options...

https://marked.js.org/#/USING_ADVANCED.md#options

@misterhtmlcss I understand that tables are not "standard" markdown (if you refer to the original implementation), but the table rendering is supported by your back-end, just in a buggy way. You should have it fixed (I hope!), or completely removed (to adhere to that "standard" markdown).
I would like also to point out that there is a work-around for this bug, as you can use an unbreakable space in the column to obtain the expected behavior. Definitely not elegant or intuitive.

@capitalaslash a PR was made by myself for this issue. @sintaxi is integrating some other bits and pieces as well and then we'll get it up on NPM for you to use. Talk soon!

@sintaxi to me it looks like the 'marked'-down people are still struggling with issues related to scenarios like this and while I think if we upgrade our build to marked 0.5.x we may overcome this particular issue.

I can confirm that marked 0.5 fixes this problem with markedjs/marked#1262

We'll consider upgrading the Markedjs version to .5.x for inclusion into our 1.x launch. Thank you for confirming my understanding. Always nice to have two heads agree over one.

Nice work. I just upgraded to v0.5.1 and published terraform@1.8.0.