New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TOC output when invoking markdown2 as a command through CLI #279
Comments
Looks like the CLI is working for linux for me. With -x you can pass extras. Sounds like you have two issues:
Let me know if -x gets you going to fix the second issue. |
@nicholasserra I can run this from CLI on the host where I need that capability so it's cool and I don't mind the other machines, but since I am running it from CLI (with When piping the |
Gotcha. I wouldn't be surprised if it were not thought out appropriately for CLI use. I'll give it a run and see what I come up with. |
@nicholasserra Thanks! I am using it in a script like this which is super neat right now without a need for a wrapper script so before I get writing one I am just curious if I need to. |
So from what i'm seeing that toc html isn't accessible in any way. I can't really think of a good way to even expose it to the CLI. Maybe it could take some kind of path as an input and then write the file to disk. Not sure, feels kinda dirty. Let me know if you have any ideas. |
Do you think it could inject the TOC HTML into the MD HTML? Perhaps with a placeholder to control where or just default to prepending? This should be opt-in when used as a Python module but default in CLI mode (distinguishable?) |
Assuming CLI vs module is distinguishable, we would need some kind of argument to pass into the CLI to turn on the appending. I'm concerned about cluttering up that space. But if it can be done cleanly i'd probably accept it. Take a peek at: There's basically just a wrapper around unicode that adds the toc_html property. I could see the append happening there. |
I don't want to default to appending in CLI to maintain backwards compat. |
I'll take a stab at that. I understand the concern about backwards compatibility when using the TOC extra with a CLI, but that is practically a no-op currently (the extra is executed, but you can't reach it) so I think the few people who are using this extra with a CLI probably just added it thinking it would get embedded within the output HTML, found it doesn't and did not remove it. I will of course honor this though and design a CLI switch or maybe a new |
Check my PR @nicholasserra. I'm so glad WSL is a thing, because I was able to develop it on Windows using VS Code but compile it and run the script in WSL with |
This should be closed once #283 is merged. |
Fixed in #283 |
I'll probably wait for a couple more fixes to land before next release. |
Hey I have installed
markdown2
using PIP in one of my Docker images and I can invoke it like this:markdown2 input.md > output.html
, but I am not able to usemarkdown2
as a command on Windows nor on WSL when installed through PIP for some reason.Is there any info on using the TOC extra through CLI? I ran the same script with the TOC extra in my CI pipeline with the Docker image where I am able to invoke
markdown2
as a command and pipe the output to a file and it didn't get embedded into the file, so I suppose I can only wrap the invocation in a Python script and write the files myself?The text was updated successfully, but these errors were encountered: