-
Notifications
You must be signed in to change notification settings - Fork 309
Blank text nodes after code blocks are "unimplemented" #355
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
Comments
After inspecting the messages mentioned. I found that the issue has to do with the '\n' in the message html: <div class="codehilite"><pre><span></span><code>openapi: Loosen anchor parameter specification to string.\n</code></pre></div>\n\n<p>This is a temporary hack, I hope. It sounds like it's covered by issues 698 and/or 700 you mentioned above.</p> Specifically: looking back at the code I can see that in case of single /** @lib/model/content.dart:1103 */
List<BlockContentNode> parseBlockContentList(dom.NodeList nodes) {
assert(_debugParserContext == _ParserContext.block);
final List<BlockContentNode> result = [];
List<ImageNode> imageNodes = [];
for (final node in nodes) {
// We get a bunch of newline Text nodes between paragraphs.
// A browser seems to ignore these; let's do the same.
if (node is dom.Text && (node.text == '\n')) continue;
// ...... I imagine this can be easily solved by replacing the existing check that the if (node is dom.Text && RegExp(r'^(\n+)$').hasMatch(node.text)) continue; I will create a new test case and work on it. |
FTR, we determined (#604 (comment)) that the pattern that triggers this quirk in the server is for the message's Markdown source to express the code block with four-space-indent syntax, rather than triple-backticks syntax. (And that does indeed cover the two original examples above, as well as all other examples we've found.) |
In a few messages, the current prototype reports as "unimplemented" a text node that appears to consist of two newlines. Specifically I see this in two recent messages on chat.zulip.org:
https://chat.zulip.org/#narrow/stream/412-api-documentation/topic/OpenAPI.20requestBody/near/1672619
https://chat.zulip.org/#narrow/stream/378-api-design/topic/unreads.3A.20access.20to.20messages/near/1668410
Both are from me; I don't know if there's some pattern in how I format things that happens to tickle this, or if that's a coincidence. In both cases, the unimplemented node appears just after a code block.
We should pin down what's happening in these messages and fix it so that we handle that HTML correctly with no complaints. For how to get the server's HTML for those messages, see comments in
test/model/content_test.dart
.The text was updated successfully, but these errors were encountered: