-
Notifications
You must be signed in to change notification settings - Fork 9
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
fix: tables with inline code with newlines #979
fix: tables with inline code with newlines #979
Conversation
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 feel like I had a lot of Big Questions on this one, but tests seem sound and run well so…lgtm! 🤘
@@ -19,6 +19,8 @@ const alignToStyle = (align: 'left' | 'center' | 'right' | null) => { | |||
|
|||
const isTableCell = (node: Node) => ['tableHead', 'tableCell'].includes(node.type); | |||
|
|||
const isLiteral = (node: Node): node is Literal => 'value' in node; |
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.
Wait, I know about as
but what is the meaning of is
in TS???
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 know the term off hand, but it means the function is restricting the type?
visit(cell, isLiteral, (node: Literal) => { | ||
if (node.value.match(/\n/)) { |
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.
What is a "literal" node anyways?
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.
Anything with a text value. I think that's text
, inlineCode
, code
, html
, yaml
'h-0': 'Field', | ||
'h-1': 'Description', | ||
'0-0': 'orderby', | ||
'0-1': '`{\n "field": "ID",\n "type": "ASC"\n }`', |
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.
What would happen if they'd wrapped this in a code block instead of an inline? Would that "just work"?
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 think so. RDMD should compile it back to magic block.
This PR was released!🚀 Changes included in v7.6.3 |
🧰 Changes
Fixes migrating tables with inline code with newlines.
Our previous check for converting markdown tables to JSX only scanned text nodes. That would skip inline code and inline html. Uh oh.
🧬 QA & Testing