Skip to content
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

[markdown-preview] Optimize re-rendering of content in a preview pane… #984

Commits on May 6, 2024

  1. Optimize re-rendering of content in a preview pane…

    …especially syntax highlighting.
    
    This change brings in `morphdom` to allow us to be more efficient about how we apply the changes needed when the Markdown source re-renders. Instead of replacing all the content with every single change, we apply only the selective edits needed to adapt our existing markup to the target markup.
    
    Once this process is done, we introduce one `TextEditor` instance for each `pre` tag in the markup, then persist those editor elements in the rendered output so that we don't have to spend so much time creating and destroying editors. This is a _huge_ performance win, especially in documents with lots of code blocks. The editor instances are cached using the `pre` elements as keys, which is now possible because the `pre` elements themselves are preserved across re-renders.
    
    Editors are created when new `pre` elements appear, and are destroyed when they are no longer needed, change their contents whenever the contents of the `pre` changes, and change language modes whenever the code fence language identifier changes.
    
    This approach is now used no matter which Markdown renderer is employed; we manage syntax highlighting ourselves in all cases rather than letting `atom.ui.markdown` do it.
    savetheclocktower committed May 6, 2024
    Configuration menu
    Copy the full SHA
    62a35bc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    18e0da8 View commit details
    Browse the repository at this point in the history
  3. Don't make TextEditor instances render synchronously…

    …because we don't need it for our use case. Helps performance.
    savetheclocktower committed May 6, 2024
    Configuration menu
    Copy the full SHA
    b46a7e8 View commit details
    Browse the repository at this point in the history
  4. Rework loading indicator for markdown-preview

    …and make the pane appear earlier on first open.
    savetheclocktower committed May 6, 2024
    Configuration menu
    Copy the full SHA
    054100b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    74589fe View commit details
    Browse the repository at this point in the history

Commits on May 15, 2024

  1. Address feedback

    Co-authored-by: Maurício Szabo <[email protected]>
    savetheclocktower and mauricioszabo authored May 15, 2024
    Configuration menu
    Copy the full SHA
    678c1b7 View commit details
    Browse the repository at this point in the history