-
Notifications
You must be signed in to change notification settings - Fork 485
feat(#2183): flexmark configuration support #2280
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
base: main
Are you sure you want to change the base?
Conversation
@@ -89,6 +89,7 @@ dependencies { | |||
compatDiktat2Dot0Dot0CompileOnly "com.saveourtool.diktat:diktat-runner:2.0.0" | |||
// flexmark | |||
flexmarkCompileOnly 'com.vladsch.flexmark:flexmark-all:0.64.8' | |||
implementation 'com.vladsch.flexmark:flexmark-util-data:0.64.8' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has to be flexmarkCompileOnly
, not implementation
. Spotless has way too many dependencies to deal with all the transitive conflicts. You can only use flexmark classes inside of FlexmarkFormatterFunc
, which gets called with a special classloader after Gradle/Maven has done the dependency resolution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nedtwigg okay, got it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nedtwigg I'm a bit confused. If we 're using only flexmarkCompileOnly
it means that I can't get access to flexmark-util-data
API inside of FlexmarkStep, which makes it impossible to run with custom configuration or am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @l3r8yJ. It's been almost a year and I don't know if you still have the interest to finish this PR.
Anyway, you can find an example of the usage of classloader in JsonSimpleStep. You need to use com.diffplug.spotless.JarState
and load the class at runtime.
implementation 'com.vladsch.flexmark:flexmark-all:0.64.8' | ||
implementation 'com.vladsch.flexmark:flexmark-util-data:0.64.8' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can't be here either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't want to finish this PR. I could take it over as long as you want to. :)
@@ -40,7 +40,7 @@ public class FlexmarkFormatterFunc implements FormatterFunc { | |||
private final Parser parser; | |||
private final Formatter formatter; | |||
|
|||
public FlexmarkFormatterFunc() { | |||
public FlexmarkFormatterFunc(final MutableDataHolder customFormatterOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you mentioned, MutableDataHolder
is not Serializable
. So we can't use it as a parameter like Gson.
We need to pass List
s of String
, like cleanthat
, or anything with zero dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be hard, since Flexmark reinvent the wheels...
import java.io.Serializable; | ||
import java.lang.reflect.Constructor; | ||
import java.util.Objects; | ||
|
||
import com.vladsch.flexmark.util.data.MutableDataHolder; | ||
import com.vladsch.flexmark.util.data.MutableDataSet; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to load the classes at runtime.
@@ -19,29 +19,38 @@ | |||
|
|||
import javax.inject.Inject; | |||
|
|||
import com.vladsch.flexmark.util.data.MutableDataSet; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No dependencies.
@qwertycxz so, If u're had an idea, go ahead please! |
@qwertycxz or I can finish it in couple of days... |
I have two ideas for this: Plan A: Let user create a Plan B: We take a parser option |
@qwertycxz I'll take a look at this a bit later and give an answer for you tomorrow or later today |
WIP PR,
closes #2183