Repository navigation
fix: render inline code in widget lists, headings and tables - #519
Merged
neuromechanist merged 1 commit intoSep 28, 2026
Conversation
renderInlineMarkdown did not handle inline code; only markdownToHtml's paragraph path converted backticks. List items, headings and table cells therefore showed literal backticks, e.g. an NWB answer's '* `session_description`: ...' list. Inline code is now matched in renderInlineMarkdown (escaped, not parsed further), and paragraphs use it directly. Indented list items, which models use for nested lists, are now kept in the list instead of becoming paragraphs with a literal '*'. Adds frontend/test-markdown.js, run with Bun in the frontend-tests job.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
neuromechanist
merged commit Sep 28, 2026
ce9d7c1
into
OpenScience-Collective:develop
7 of 8 checks passed
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While testing the NWB community on dev, this answer rendered with literal backticks in the widget:
Cause:
renderInlineMarkdownhandles bold, italics, links, URLs and citations, but not inline code. OnlymarkdownToHtml's plain-paragraph path converted backticks, before calling it. List items, numbered items, headings and table cells callrenderInlineMarkdowndirectly, so their inline code came out as`session_description`.Fix:
renderInlineMarkdownnow matches inline code alongside the other inline elements. The content is escaped and isn't parsed further, so*,**and[1]inside code stay literal. The paragraph path now just callsrenderInlineMarkdown, which removes the duplicate handling.* item, which models use for nested lists) now stay in the list. Before, they fell through to a paragraph showing a literal*. Nesting is flattened.Tests
frontend/test-markdown.js, in the same style astest-citation-markers.js: it runs the widget's ownmarkdownToHtml. It covers the answer above, numbered lists, headings, table cells, escaping and non-parsing of code content, a bracketed number inside code not being linked as a citation, unchanged paragraph output, and indented items. 13 pass with the fix; 11 fail ondevelop.test.ymlandtests.yml.frontend/test-citation-markers.jsandfrontend/test-streaming.jsstill pass. I ran these locally with Node because Bun isn't installed; the files use only APIs both support.pytest tests/test_frontend -k 'not workspace_export': 43 passed.test_workspace_export.pyneeds Bun.