Skip to content
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

Mordant 2.0 #8

Closed
ajalt opened this issue Nov 1, 2020 · 8 comments
Closed

Mordant 2.0 #8

ajalt opened this issue Nov 1, 2020 · 8 comments

Comments

@ajalt
Copy link
Owner

ajalt commented Nov 1, 2020

Mordant 2.0 is a complete rewrite that adds support for markdown rendering, animations, and renderable components like lists and tables. Specifying colors and styles can now be done through static members of the TextColors and TextStyles enums. You don't need to pass around a TermColors instance everywhere; you just need to print the final strings with Terminal.print if you want the ANSI codes downsampled.

There's still a lot I'd like to do before a stable release.

  • Lots of docs two write, including an mkdocs site
  • Multiplatform support. The biggest blocker here is the intellij-markdown dependency. I can contribute native support there if necessary.
  • Better animation support, especially for periodic animations like spinners and progress bars. It would probably be helpful to add a DSL for progress updates that can animate a progress bar or spinner, automatically calculate time elapsed/remaining etc. This might be tricky on JS or Native. Maybe it would be best to add kotlinx.coroutines as a dependency rather than try to do concurrency manually.
  • Automatically update detected terminal dimensions when the window is resized.
  • Maybe get rid of Terminal.colors. It's the equivalent of Mordant 1's TermColors, but isn't necessary if you use Terminal.println. We could simplify a few things if we got rid of it. If we did, you could still use regular println instead of the Terminal version, you would just need to pass your stings through Terminal.render if you want your ANSI codes downsampled.

If anyone can try out the alpha, I'd love to hear your feedback on API, implementation, features, or anything else. You can comment on this issue, start a conversation in the #clikt channel on the kotlinlang slack, or DM me on ASG or kotlinlang slack.

@robstoll
Copy link

robstoll commented Mar 8, 2021

Hi @ajalt, stumbled over your library, looks pretty promising 🙂 I am wondering if you plan to break all the experimental interfaces until 2.0 or if they are already safe to use.
Also, I would like to use it in a JS project. I read here #3 that you are waiting for a PR to be merged. As far as I can see it is but the corresponding change not yet publish. So I guess you still wait for JetBrains? Any chance you publish an artifact consumable by a JS project beforehand?

@ajalt
Copy link
Owner Author

ajalt commented Mar 26, 2021

@robstoll version 2.0.0-beta1 was just released with JS support. There shouldn't be any more major API changes, so give it a try and let me know if it works out for you,

@mikehearn
Copy link
Contributor

Unfortunately I cannot try this, though I'd like to. Maven can't resolve it due to the missing colormath JARs. Will try it out when that's fixed! The functionality looks great. I'm not sure if it's worth limiting the library too much for JS and Native. At least, the JVM version can be compiled to fast native binaries using GraalVM now. And I'm not sure there is much use for this in the JS world, which has similar libraries already.

@ajalt
Copy link
Owner Author

ajalt commented Apr 6, 2021

Colormath is definitely published; maven central might have had an outage when you tried.

The JS target isn't designed to be used as an npm package from pure JS; it's targeted towards projects written in Kotlin/JS. Other node libraries exist, but mordant should be the best to use from Kotlin.

@mikehearn
Copy link
Contributor

OK, it works with Maven (the tool) if you specify mordant-jvm as the artifact ID instead of just mordant. The reason is, the mordant/colormath POMs are empty, as are the javadoc JARs published alongside them.

I think what's happened here is that Gradle/Kotlin MPP is publishing POMs that aren't actually usable by Maven but in such a way that Maven itself doesn't notice there's anything wrong. It then generates a useless/misleading error message. I suspect this is a side-effect of the desire to use Maven Central as a CDN which would normally insist on having a JAR and a POM, but Gradle wants to only publish its own JSON module file, so it ends up making these empty files. Not ideal.

I think the fix is to provide separate instructions for Maven users that contains the JVM specific artifact, as Maven cannot read the multi-platform lib metadata anyway. I'll open a quick PR.

@jmfayard
Copy link

jmfayard commented May 7, 2021

Hello @ajalt
could you notify me when intellij/markdown and therefore mordant is available on Kotlin/Native?
I want to integrate it to my starter project for building command line tools

https://github.com/jmfayard/kotlin-cli-starter

@ajalt
Copy link
Owner Author

ajalt commented Jun 2, 2021

Mordant 2.0.0-beta2 has been released, which includes macosX64 support (@jmfayard)

jmfayard added a commit to jmfayard/kotlin-cli-starter that referenced this issue Jun 2, 2021
@jmfayard
Copy link

jmfayard commented Jun 2, 2021

I can confirm it works, thanks a lot @ajalt

@ajalt ajalt closed this as completed Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants