Skip to content

HTML header contents in markdown notebook cells not correctly populated in breadcrumbs #134853

Closed

Description

@joyceerhl

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: github.dev
  • OS Version: Windows 10

Steps to Reproduce:

  1. Visit https://github.dev/lostintangent/python-tuples
  2. Select any of the markdown cells
  3. 🐛 breadcrumb preview says 'empty cell', this is apparently because the cell headers are created with HTML; if I rewrite them to be Markdown the breadcrumbs are accurate
    image

Activity

  1. mjbvz commented on Oct 12, 2021

    @mjbvz
    Contributor

    Here's the relevant code:

    for (const token of marked.lexer(content, { gfm: true })) {

    We currently only look for markdown headers. Instead, we'd likely want to get the headers from the rendered markup. That would nicely support other types of rendered markup or extensions to the markdown rendering

  2. added
    feature-request
    on Oct 12, 2021
  3. added this to the Backlog milestone on Oct 12, 2021
  4. IanMatthewHuff commented on Oct 13, 2021

    @IanMatthewHuff
    Member

    This would also be a big improvement for Outline view I believe. Jupyter picks up HTML headers and adds them to the table of contents view, but in VS Code we miss out on them so the structure looks funny with some notebooks.

  5. removed their assignment
    on Oct 21, 2021
  6. added
    help wanted
    on Nov 16, 2021
  7. added 2 commits that reference this issue on Sep 7, 2022
  8. rebornix commented on Sep 7, 2022

    @rebornix
    Contributor

    Pushed a fix to parse the content for h1 to h6 headers written as HTML tags. It's synchronous and performant, doesn't require the full rendering of all markdown cells either. The catch with this is we are only finding headers, the markdown cells with <p> will still be rendered as empty cells in TOC.

    cc Matt Bierner (@mjbvz) what's your recommendation of improving this further more? marked plaintext renderer will skip all html tags, does it mean to get proper gist of a markdown cell, we do need to have it rendered in the webview?

  9. mjbvz commented on Sep 7, 2022

    @mjbvz
    Contributor

    Peng Lyu (@rebornix) Do you mean handling cases where the user has written raw html tags inside their markdown? For that we could turn on supportHtml:

    if (!markdown.supportHtml) {

    That will let the tags through, which I think is ok so long as are only looking at the tokens and not actually rendering the resulting html

  10. added
    verification-needed
    on Sep 27, 2022
  11. added
    verified
    on Sep 27, 2022
  12. locked and limited conversation to collaborators on Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

breadcrumbsfeature-requesthelp wantednotebook-markdownoutlineverification-neededverified

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions