Language Server: Markdown not rendering properly

Here’s a little snapshot of it working with my LSP extension:

1 Like

Apparently, that was grounded in fact.

2 Likes

I’m running up against this again. I’m looking at improving the documentation rendering in GitHub - typescript-language-server/typescript-language-server: TypeScript & JavaScript Language Server, and the experience in Nova is pretty bad.

The markdown:
```typescript
constructor Dot(x: number, y: number, width: number): Dot
```

Create a dot.

* _@param_ ``` x ``` — The x value.
* _@param_ ``` y ``` — The y value.
* _@param_ ``` width ``` — The width of the dot, in pixels.
* _@example_ — testing
  ```typescript
  new Dot(x, y, z)
  ```
Nova's rendering:

Note the odd paddings, the lack of a break above the code block in the last <li>, the additional bullet after that, and the lack of syntax highlighting.

Here's what it renders like in this forum:
constructor Dot(x: number, y: number, width: number): Dot

Create a dot.

  • @param x — The x value.
  • @param y — The y value.
  • @param width — The width of the dot, in pixels.
  • @example — testing
    new Dot(x, y, z)
    

I can get syntax highlighting if I use MarkedString (which is what the server currently uses), but that type is now deprecated in the language server protocol in favor of MarkedContent, so I don’t want to keep using it.

Nova also only renders the first of the set of MarkedStrings returned in the onHover response.

1 Like

Interesting…

If I return this MarkedString: { language: 'markdown', value: '...' }, the code fence’s syntax highlighting works. (In some ways, this is more readable than the native markdown rendering).

1 Like

We’re @logan’s nightmare…

@apexskier, what you’re describing is not yet on the latest version of your extension, right? It’s just because I only get a much simpler output than what you show above (I’m using your extension as listed on the Library).

My guess is that, as @logan explained in the past, current Markdown support on the hover boxes is limited (and it’s not really rendered into HTML, but directly to the UI). I was pretty sure he had posted something about it here on the dev forums, but I guess I’m just confused since a search returned nothing… except that it was being worked on (and it is working — with limitations ).

Yeah, this is running against a branch on my fork of the underlying language server.

1 Like

Hopefully this can be taken advantage of to improve this. GitHub - apple/swift-markdown: A Swift package for parsing, building, editing, and analyzing Markdown documents.

5 Likes