darkriszty / MarkdownTablePrettify-VSCodeExt

Visual Studio Code extension to prettify markdown tables.
MIT License
64 stars 4 forks source link

Dockerization of main logic #32

Closed slmg closed 4 years ago

slmg commented 4 years ago

First of all thank you for creating this extension. I used it a bit and I find it pretty neat. It greatly improves readability to prettify markdown tables.

To give you a bit of context I am auto-generating some markdown tables using terraform-docs (another very cool tool btw if you find yourself working on some terraform project). The result table renders well in html but isn't pretty, so at that point I find this extension very useful to prettify it. So far so good.

Problem comes at the moment of trying to automate this process within a CI pipeline: it would be nice to have doc automatically generated and nicely formatted. Therefore I am wondering if you would be up to extract the core logic of your extension and dockerize it, to enable a use such as:

# Generate rendered md to stdout to avoid potential file acl problems
docker container run -v "$(pwd)":/data darkriszty/prettify-md INPUT.md > OUTPUT.md

# Another potential use I can think of in CI: enforce table prettiness within a team
docker container run -v "$(pwd)":/data darkriszty/prettify-md --check # fail if not pretty

I know this request is technically outside the scope of this project, but I found it made sense to raise as I think your existing code could be re-used fairly easily inside a node base image. This image could then be used to create a Github action and would easily be available to anyone willing to prettify their tables.

Thanks!

darkriszty commented 4 years ago

Hi @slmg,

I'm glad you like the extension! 🙂

This definitely sounds like a big project, but extracting the core logic to not be depend on the VSCode API is something that I was also thinking about for some time. My plan would be to have some sort of a CLI that's able accept a file, similarly to your example. Later, this could be then be also used in the contexts you mentioned.

I'm going to work on the CLI version in the context of this issue. Thanks for the suggestions!

darkriszty commented 4 years ago

Hi, I managed to extract the core logic as a stand alone CLI feature in the project and to set up a docker image with it. I'm not currently planning to use this in a CI pipeline or to prettify files from the terminal/scripts, but I hope that you and others might find it useful. 🙂

Available features from the command line

Available features from docker (https://hub.docker.com/r/darkriszty/prettify-md)

slmg commented 3 years ago

Hi @darkriszty,

Thank you for doing this work, this is very useful! I started to use the docker image in CI and it works perfectly. :+1: I will soon create a new issue (and a PR :slightly_smiling_face: ) to report my feedbacks.