zed/crates
Kieran Gill 61b8d3639f
markdown_preview: Improved markdown rendering support (#7345)
This PR improves support for rendering markdown documents.

## After the updates


https://github.com/zed-industries/zed/assets/18583882/48315901-563d-44c6-8265-8390e8eed942

## Before the updates


https://github.com/zed-industries/zed/assets/18583882/6d7ddb55-41f7-492e-af12-6ab54559f612

## New features

- @SomeoneToIgnore's [scrolling feature
request](https://github.com/zed-industries/zed/pull/6958#pullrequestreview-1850458632).
- Checkboxes (`- [ ]` and `- [x]`)
- Inline code blocks.
- Ordered and unordered lists at an arbitrary depth.
- Block quotes that render nested content, like code blocks.
- Lists that render nested content, like code blocks.
- Block quotes that support variable heading sizes and the other
markdown features added
[here](https://github.com/zed-industries/zed/pull/6958).
- Users can see and click internal links (`[See the docs](./docs.md)`).

## Notable changes

- Removed dependency on `rich_text`.
- Added a new method for parsing markdown into renderable structs. This
method uses recursive descent so it can easily support more complex
markdown documents.
- Parsing does not happen for every call to
`MarkdownPreviewView::render` anymore.

## TODO

- [ ] Typing should move the markdown preview cursor.

## Future work under consideration

- If a title exists for a link, show it on hover.
- Images. 
- Since this PR brings the most support for markdown, we can consolidate
`languages/markdown` and `rich_text` to use this new renderer. Note that
the updated inline text rendering method in this PR originated from
`langauges/markdown`.
- Syntax highlighting in code blocks.
- Footnote references.
- Inline HTML.
- Strikethrough support.
- Scrolling improvements:
- Handle automatic preview scrolling when multiple cursors are used in
the editor.
- > great to see that the render now respects editor's scrolls, but can
we also support the vice-versa (as syntax tree does it in Zed) — when
scrolling the render, it would be good to scroll the editor too
- > sometimes it's hard to understand where the "caret" on the render
is, so I wonder if we could go even further with its placement and place
it inside the text, as a regular caret? Maybe even support the
selections?
- > switching to another markdown tab does not change the rendered
contents and when I call the render command again, the screen gets
another split — I would rather prefer to have Zed's syntax tree
behavior: there's always a single panel that renders things for whatever
tab is active now. At least we should not split if there's already a
split, rather adding the new rendered tab there.
- > plaintext URLs could get a highlight and the click action

## Release Notes

- Improved support for markdown rendering.
2024-02-08 11:19:31 +02:00
..
activity_indicator chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
ai fix: use OPEN_AI_API_URL (#7484) 2024-02-07 10:13:52 +01:00
assets chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
assistant Add logic for managing language and theme extensions (#7467) 2024-02-07 15:14:50 -05:00
audio chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
auto_update chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
breadcrumbs chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
call chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
channel Use collections::{HashMap, HashSet} instead of its std:: counterpart (#7502) 2024-02-07 19:06:03 +02:00
cli chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
client Use collections::{HashMap, HashSet} instead of its std:: counterpart (#7502) 2024-02-07 19:06:03 +02:00
clock Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
collab Add logic for managing language and theme extensions (#7467) 2024-02-07 15:14:50 -05:00
collab_ui allow closing reply to preview with action 2024-02-07 21:14:36 +01:00
collections gpui: Add Global marker trait (#7095) 2024-01-30 14:08:20 -05:00
color chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
command_palette chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
copilot chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
copilot_ui Add information to Copilot sign-in UI when disabled (#7496) 2024-02-07 22:28:02 -07:00
db chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
diagnostics chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
editor Reload grammars in extensions when they are updated on disk (#7531) 2024-02-07 16:39:11 -08:00
extension Reload grammars in extensions when they are updated on disk (#7531) 2024-02-07 16:39:11 -08:00
feature_flags chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
feedback chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
file_finder chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
fs Merge branch 'main' into kvark-linux 2024-02-07 11:52:44 -08:00
fsevent fix: isolate macos-specific dependencies (#6854) 2024-01-27 13:38:55 +01:00
fuzzy chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
git chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
go_to_line chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
gpui Fix compile errors on Linux (#7527) 2024-02-07 18:46:24 -05:00
gpui_macros Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
install_cli chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
journal chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
language Reload grammars in extensions when they are updated on disk (#7531) 2024-02-07 16:39:11 -08:00
language_selector chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
language_tools Add logic for managing language and theme extensions (#7467) 2024-02-07 15:14:50 -05:00
live_kit_client Restore nanoid dependency 2024-02-07 12:04:29 -08:00
live_kit_server Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
lsp chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
markdown_preview markdown_preview: Improved markdown rendering support (#7345) 2024-02-08 11:19:31 +02:00
media linux: various fixes across the crates to make it compile 2024-02-03 00:06:20 -08:00
menu chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
multi_buffer chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
node_runtime chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
notifications chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
outline text rendering: support strikethroughs (#7363) 2024-02-07 16:51:27 +02:00
picker chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
plugin chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
plugin_macros Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
plugin_runtime Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
prettier chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
project Fix panic! caused by bad utf16 clipping (#7530) 2024-02-07 16:35:30 -07:00
project_panel Use collections::{HashMap, HashSet} instead of its std:: counterpart (#7502) 2024-02-07 19:06:03 +02:00
project_symbols Add logic for managing language and theme extensions (#7467) 2024-02-07 15:14:50 -05:00
quick_action_bar chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
recent_projects chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
refineable Sort dependencies in Cargo.toml files (#7126) 2024-01-30 21:41:29 -05:00
release_channel chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
rich_text chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
rope chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
rpc Remove Default impl for ConnectionId (#7452) 2024-02-06 15:45:15 -05:00
search Use collections::{HashMap, HashSet} instead of its std:: counterpart (#7502) 2024-02-07 19:06:03 +02:00
semantic_index Add logic for managing language and theme extensions (#7467) 2024-02-07 15:14:50 -05:00
settings chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
snippet Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
sqlez Use collections::{HashMap, HashSet} instead of its std:: counterpart (#7502) 2024-02-07 19:06:03 +02:00
sqlez_macros chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
story chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
storybook chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
sum_tree Clean up Cargo.toml files (#7044) 2024-01-29 23:47:20 -05:00
terminal Use collections::{HashMap, HashSet} instead of its std:: counterpart (#7502) 2024-02-07 19:06:03 +02:00
terminal_view terminal: strikethrough text (#7507) 2024-02-07 16:36:30 -07:00
text chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
theme Reload theme using ThemeSettings::reload_current_theme (#7522) 2024-02-07 16:56:24 -05:00
theme_importer theme_importer: Add --output flag for outputting the theme to a file (#7486) 2024-02-07 16:23:36 -05:00
theme_selector chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
ui chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
util Clean up util::paths (#7536) 2024-02-07 21:01:45 -05:00
vcs_menu chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
vim Fix Vim 'e' Behavior When Boundary Is Last Point on Line (#7424) 2024-02-06 20:25:56 -07:00
welcome chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00
workspace Reload theme using ThemeSettings::reload_current_theme (#7522) 2024-02-07 16:56:24 -05:00
zed Reload theme using ThemeSettings::reload_current_theme (#7522) 2024-02-07 16:56:24 -05:00
zed_actions chore: Move workspace dependencies to workspace.dependencies (#7454) 2024-02-06 20:41:36 +01:00