StackExchange / StackExchange/Stacks-Editor

bug(commonmark) Header html tags in table cells do not round-trip or preview properly

Open
#183 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug commonmark
Dominant language
TypeScript
Stars
437
Forks
61
Avg merge
16h 2m
Merged PRs (30d)
8

Description

Describe the bug
Header html tags used in table header or body cells end up not previewing properly in RT mode and mangle the table upon round-trip. It works in current editor when saved to the site - renders properly.

To Reproduce

  1. MD mode, create table, add an h1 html tag in any cell around the text
  2. Go to RT mode, observe that the tag has been transformed as a literal
  3. Go back to MD mode and the table syntax is all messed up and mangled

Expected behavior
Ideally we would support header elements in table cells. The GH MD table spec does not mention it, but the current editor and on-side rendering support it. If we decide not to support it, should at least allow round-trip without destroying the table markdup.

Screenshots
demo

Desktop (please complete the following information):
Windows 11 Chrome 103

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in the Stacks-Editor MD and RT modes with a table cell containing an h1 HTML tag, then inspect the commonmark conversion path. Done means the header renders correctly in RT mode and returning to MD mode preserves the table syntax, or preserves it without mangling if header elements remain unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.