-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add tables extension #339
base: main
Are you sure you want to change the base?
Add tables extension #339
Conversation
Also, maybe we could make most of the nodes data classes, but it will require merging some underlying CLs to make inline nodes value classes. |
As I mentioned before, I don't have rights to push to existing branches making this impossible: For example, this check is a requirement for feature branches https://github.com/JetBrains/jewel/blob/main/.github/workflows/codeql.yml#L7, but I don't think running it in a fork will give me an ability to push to |
You have full write access to this repository, you shouldn't need to have a fork. I have weakened the branch protection rules even more than they already were. You should be able to push and force push to any branch directly with the exception of main. |
4e0a262
to
49ce567
Compare
Let's sync on that over video when you have time. I'm getting the same error:
|
49ce567
to
13a02f7
Compare
13a02f7
to
cdf90a7
Compare
@@ -189,8 +190,9 @@ public class MarkdownProcessor( | |||
is ThematicBreak -> MarkdownBlock.ThematicBreak | |||
is HtmlBlock -> toMarkdownHtmlBlockOrNull() | |||
is CustomBlock -> { | |||
extensions.find { it.processorExtension?.canProcess(this) == true } | |||
extensions.find { it.processorExtension.canProcess(this) } |
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.
Why aren't we just dropping blocks that can't get processed?
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.
Not sure I'm following what you mean here: are asking why we are keeping noop extensions? I'm planning to fix that later... my ideal API would just run tryProcess
and only register extensions if they do something.
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, I am asking why we have an Elvis that returns a DefaultCustomBlock, which is something that really makes no sense to me. If it's a custom block, the concept of default is meaningless. We should not have it; instead, every extension should have its own custom block(s) — e.g., TableBlock(...): CustomBlock
} | ||
|
||
publicApiValidation { | ||
// TODO Oleg remove this once migrated to value classes |
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.
Hi @obask there is a TODO here for ya :) (and in at least another module, too!)
) { | ||
if (block !is CustomBlock.DefaultCustomBlock) return | ||
|
||
val head = block.nativeBlock.firstChild as TableHead |
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.
Gotta love CommonMark APIs 🙃
Can we expose head and body as properties on our table block model?
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.
I don't want to invoke the processor unless it's needed for something. Right now the CustomBlock
is an interface and we can always convert it to data classes later if we need to.
public class TableStyling( | ||
public val headColor: Color, |
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.
Is this a background or content color? Please name accordingly
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.
My initial plan was to make it work as an alpha version. (I didn't think adding tables would be so easy) But yes, we should probably set the right styling in place.
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.
I would want to avoid having a half-implemented table extension merged in, unless we're sure the rest of the behaviour/styling is ready to go quickly (one day?)
headColor: Color = Color.DarkGray, | ||
borderColor: Color = Color.Gray, |
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.
Are these defaults taken from the GitHub CSS, or arbitrary? If arbitrary, please get the actual values from the GitHub CSS (I recommend creating a table in a gist and inspecting in both light and dark themes)
import org.jetbrains.jewel.foundation.GenerateDataFunctions | ||
|
||
@GenerateDataFunctions | ||
public class TableStyling( |
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.
I don't see any facility to set things like cell padding, min row height, etc. Are those coming later? Or simply weren't considered?
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.
My goal was to add an initial implementation of tables and change it later to follow more specific requirements. So the answer is "weren't considered".
Oh btw make sure all extensions are registered in the mergeSarif task — I suspect we may have forgotten that for previous PRs, too — not just this one. See Lines 8 to 21 in 5d33bd5
|
*please ignore commits before Wire up GFM Tables extension