helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.71k stars 2.5k forks source link

Bad markdown table format in docs preview (`<space-k>`) #11175

Open HairlessVillager opened 3 months ago

HairlessVillager commented 3 months ago

Summary

image

Reproduction Steps

Here is a reproduction steps:

  1. open a Rust source code file and write:
    
    fn main() {}

/// /// # H1 /// /// ## H2 /// /// ### H3 /// /// bold text /// /// italicized text /// /// > blockquote /// /// 1. First item /// 2. Second item /// 3. Third item /// /// - First item /// - Second item /// - Third item /// /// code /// /// --- /// /// title /// /// alt text fn foo() {}

/// | Syntax | Description | /// | --------- | ----------- | /// | Header | Title | /// | Paragraph | Text | /// /// /// { /// "firstName": "John", /// "lastName": "Smith", /// "age": 25 /// } /// /// /// Here's a sentence with a footnote. [^1] /// /// [^1]: This is the footnote. /// /// ### My Great Heading {#custom-id} /// /// term /// : definition /// /// The world is flat. /// /// - [x] Write the press release /// - [ ] Update the website /// - [ ] Contact the media /// /// That is so funny! :joy: /// /// I need to highlight these ==very important words==. /// /// H~2~O /// /// X^2^ fn bar() {}


2. ensure the lsp is running
3. move to the `foo` in line 68, and press space bar then the key `k`
4. the popup will looks like:
![image](https://github.com/user-attachments/assets/56d70bba-d648-4d6d-b109-964f9af251cc)

Expect it looks like:
![image](https://github.com/user-attachments/assets/acd4d51e-3cbf-464d-880b-36979c01cacc)

### Helix log

<details><summary>~/.cache/helix/helix.log</summary>

```log
2024-07-15T13:53:33.147 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":5,"line":67},"textDocument":{"uri":"file:///E:/code/rust/trpl/trial/src/main.rs"}},"id":1}
2024-07-15T13:53:33.150 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2024-07-15T13:53:33.156 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":1,"result":{"contents":{"kind":"markdown","value":"\n```rust\ntrial\n```\n\n```rust\nfn bar()\n```\n\n---\n\n|Syntax|Description|\n|------|-----------|\n|Header|Title|\n|Paragraph|Text|\n\n```rust\n{\n  \"firstName\": \"John\",\n  \"lastName\": \"Smith\",\n  \"age\": 25\n}\n```\n\nHere's a sentence with a footnote. [^1]\n\n[^1]: This is the footnote.\n\n### My Great Heading {#custom-id}\n\nterm\n: definition\n\n~~The world is flat.~~\n\n* [x] Write the press release\n* [ ] Update the website\n* [ ] Contact the media\n\nThat is so funny! :joy:\n\nI need to highlight these ==very important words==.\n\nH~2~O\n\nX^2^"},"range":{"start":{"line":67,"character":3},"end":{"line":67,"character":6}}}}
2024-07-15T13:53:33.156 helix_lsp::transport [INFO] rust-analyzer <- {"contents":{"kind":"markdown","value":"\n```rust\ntrial\n```\n\n```rust\nfn bar()\n```\n\n---\n\n|Syntax|Description|\n|------|-----------|\n|Header|Title|\n|Paragraph|Text|\n\n```rust\n{\n  \"firstName\": \"John\",\n  \"lastName\": \"Smith\",\n  \"age\": 25\n}\n```\n\nHere's a sentence with a footnote. [^1]\n\n[^1]: This is the footnote.\n\n### My Great Heading {#custom-id}\n\nterm\n: definition\n\n~~The world is flat.~~\n\n* [x] Write the press release\n* [ ] Update the website\n* [ ] Contact the media\n\nThat is so funny! :joy:\n\nI need to highlight these ==very important words==.\n\nH~2~O\n\nX^2^"},"range":{"end":{"character":6,"line":67},"start":{"character":3,"line":67}}}

Platform

Windows 10

Terminal Emulator

Windows Terminal Version: 1.20.11781.0

Installation Method

releases page

Helix Version

helix 24.3 (2cadec0b)

pascalkuthe commented 3 months ago

we don't really render tables at all. We need to add handle the table tag in the markdown UI component