Repository: vscode
Issue: All <span> tags in hover have a 4px bottom margin which causes nested spans to have stacking bottom margins
Labels: bug,editor-hover

Type: <b>Bug</b>

When an extension provides a hover using the `HoverProvider.provideHover` API, and the hover contains Markdown with HTML in it, every span gets a 4px bottom margin. This was added in https://github.com/microsoft/vscode/pull/107442 due to  https://github.com/microsoft/vscode-pull-request-github/issues/1937 

This means that nested spans will get stacking margins, and vertically stacked spans will have gaps between them which may be undesirable depending on how the author of the extension wants to style the hover.

Because of the (understandably) restrictive CSS allowed in `markdownRenderer.ts`, we cannot remove this bottom margin. 

I would consider the stacking margins with nested spans to be a bug, because nested spans may be required to do certain types of styling of text and it does not seem correct for that to cause the margin to expand with each level of nesting.

Demonstration of problem:
![Image](https://github.com/user-attachments/assets/56ef4a6b-6951-4c61-87af-a8d34d261abc)

To reproduce this:
1. build and install the extension at https://github.com/navtej-ac/vscode-hover-sample-extension ... It is based on the Hello World Minimal Sample from the `vscode-extension-samples` repo.
2. With the extension installed, activate it by running the "Hello World" command 
3. Then hover on any line the text editor. On every other line we show the hover with background colors and demonstrate both the gap between spans and the background color and the stacking of margins. On the remaining lines we try to show a hover with `margin:0` added to the spans' styling, which causes the HTML sanitizer to strip the styles

Expected: spans with background colors can nest without the outer span increasing in height and spans with backgrounds do not have a vertical gap between them.

Actual: nested spans all have 4px margins which accumulate and vertically stacked spans have a gap between them.

Proposed Fix: Add `margin:0` to the list of allowed styles in `markdownRenderer.ts`.

VS Code version: Code 1.94.2 (Universal) (384ff7382de624fb94dbaf6da11977bba1ecd427, 2024-10-09T16:08:44.566Z)
OS version: Darwin arm64 23.6.0
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Apple M3 (8 x 2400)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled<br>webnn: disabled_off|
|Load (avg)|11, 9, 9|
|Memory (System)|16.00GB (0.40GB free)|
|Process Argv|--disable-extensions --crash-reporter-id 05b8a457-1897-4b62-8507-c739f0441e0b|
|Screen Reader|no|
|VM|0%|
</details>Extensions disabled<details>
<summary>A/B Experiments</summary>

```
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
vscaac:30438847
c4g48928:30535728
azure-dev_surveyone:30548225
vscrpc:30673769
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
f3je6385:31013174
dvdeprecation:31068756
dwnewjupyter:31046869
impr_priority:31102340
nativerepl1:31139838
refactort:31108082
pythonrstrctxt:31112756
wkspc-onlycs-t:31132770
wkspc-ranged-t:31151552
cf971741:31144450
defaultse:31146405
iacca2:31156134
notype1:31157159
5fd0e150:31155592
dwcopilot:31164048
iconenabled:31158251

```

</details>

<!-- generated by issue reporter -->