-
Up until now, I've been using In an attempt to correct this behaviour, I switched to using I've made some progress towards partly fixing this behaviour in Plate, but I'm not certain I'm creating correctly structured code blocks in my tests. Here's what I've currently got in my test for
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Correct structure: {
"type": "code_block",
"children": [
{
"type": "code_line",
"children": [
{
"text": "line 1"
}
]
},
{
"type": "code_line",
"children": [
{
"text": "line 2"
}
]
}
]
} It looks like the toggle is not working well, which could be due to the normalizer. Could you try adding Tracked in #2161 Thanks again for your help! |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply! The current implementation of With Before normalization [
{
"text": "line 1"
},
{
"type": "code_block",
"children": [
{
"type": "code_line",
"children": [
{
"text": "line 2"
}
]
}
]
}
] After normalization [
{
"type": "code_block",
"children": [
{
"type": "code_line",
"children": [
{
"text": "line 2"
}
]
}
]
}
] I'm working on a fixed implementation of
|
Beta Was this translation helpful? Give feedback.
-
I'm working on the assumption that |
Beta Was this translation helpful? Give feedback.
-
The only thing the normalizer does currently is ensure that all children of a code block are code lines. I've added a test that proves it can successfully convert a paragraph child to a code line. It throws an error if I try it with a text node child (i.e. Theoretically, it might be useful if Tomorrow, I'll take a look at why |
Beta Was this translation helpful? Give feedback.
-
Created a draft PR #2163 |
Beta Was this translation helpful? Give feedback.
Thanks for your reply!
The current implementation of
unwrapCodeBlock
, withoutwithoutNormalizing
, replaces a correctly-structured code block with[]
, removing it entirely.With
withoutNormalizing
, it unwraps the firstcode_line
to an orphaned text node, which is removed upon normalization. The secondcode_line
remains in the code block.Before normalization
After normalization
[ { …