community-plugins icon indicating copy to clipboard operation
community-plugins copied to clipboard

πŸ› Announcements: Markdown not rendering properly

Open zjperschall opened this issue 11 months ago β€’ 9 comments

Workspace

announcements

πŸ“œ Description

When creating an announcement, the interface displays a WYSIWYG interface for crafting the announcement. I like the interface and the active preview. However, when clicking on the published announcement, the markdown formatting is not accurately rendering.

πŸ‘ Expected behavior

It should render the announcement formatting as displayed in the WYSIWYG editor.

πŸ‘Ž Actual Behavior with Screenshots

Here are screenshots that display what it looks like it in the editor versus what it looks like rendered.

Image Image

πŸ‘Ÿ Reproduction steps

  • With the plugin installed, place the following code in the announcement submission (remove the escape ticks for the code block example)
**Bold**
*Italics*
~~Strikethrough~~

---

# Title1
## Title2
### Title3
#### Title4
##### Title5
###### Title6

[Link](https://www.example.com)

> Quote

`This is code`

/`/`/`
import { someFunction } from @some/thing;

const someFunction();
/`/`/`

- List 1
- List 2
- List 3

1. Numbered List 1
2. Numbered List 2
3. Numbered List 3
  • Validate the formatting in the WYSIWYG preview side
  • Submit the announcement
  • View the announcement

πŸ“ƒ Provide the context for the Bug.

No response

πŸ‘€ Have you spent some time to check if this bug has been raised before?

  • [x] I checked and didn't find similar issue

🏒 Have you read the Code of Conduct?

Are you willing to submit PR?

No, but I'm happy to collaborate on a PR with someone else

zjperschall avatar Mar 07 '25 19:03 zjperschall

Hey @zjperschall, I tried to reproduce this in my local dev environment, but I wasn’t able to get the same result using your provided markdown content.

Have you customized your Backstage instance? That might be affecting the rendering.

The result I got on my side: Image

gaelgoth avatar Mar 14 '25 10:03 gaelgoth

@gaelgoth Yes, we absolutely have customized our installation. I'm actually glad that you were not able to duplicate.

I'd like to keep this issue open while I troubleshoot what may be causing it in our internal instance in the hopes that it might result in helping others in the future.

zjperschall avatar Mar 14 '25 14:03 zjperschall

We have upgraded to the newest versions of this lib and are experiencing this to be partially working. Many of the GitHub style syntax keywords work as expected but these in particular do not:

https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/

What is interesting is that the above keywords work in the WYSIWIG edtior, but not in the announcements themselves.

Image

but not in the announcement itself

Image

eskimoquinn avatar Mar 14 '25 16:03 eskimoquinn

πŸ‘‹πŸΎ @eskimoquinn, the card display uses <MarkdownContent> from the Backstage core React components. It works well for basic Markdown formatting but doesn’t fully support advanced formats such as GitHub Admonitions πŸ˜•.

Here is my takeaway:

To truely make it WYSIWYG, we should replace <MarkdownContent> by <MDEditor.Markdown> (which is the one used for editing the announcements).

I did a quick and dirty test, and it works. But I think it could have a major impact, so I’d prefer to have @kurtaking involved:

return (
    <InfoCard
      title={announcement.title}
      subheader={subHeader}
      deepLink={deepLink}
    >
-      <MarkdownContent content={announcement.body} />
+      <Box p={2}>
+        <MDEditor.Markdown source={announcement.body} style={{ backgroundColor: 'transparent', color: theme.palette.text.primary }} />
+      </Box>
    </InfoCard>
  );

The result:

Image

gaelgoth avatar Mar 14 '25 17:03 gaelgoth

For us, the issue was that we were using the topology plugin and it was including a component from patternfly that overrides the rendered CSS (@patternfly/react-core/dist/styles/base.css). Once I uninstalled that plugin, it was resolved. Since we aren't actively using that plugin, I'm not currently intending to troubleshoot further on my specific use case.

Leaving open for the admonitions discussion.

zjperschall avatar Mar 14 '25 17:03 zjperschall

Here is my takeaway:

To truely make it WYSIWYG, we should replace <MarkdownContent> by <MDEditor.Markdown> (which is the one used for editing the announcements).

I did a quick and dirty test, and it works. But I think it could have a major impact, so I’d prefer to have @kurtaking involved:

Willing to take a few votes here on if this provides a better experience. I will check out how it looks for myself over the weekend.

kurtaking avatar Mar 14 '25 19:03 kurtaking

Thanks @kurtaking and @gaelgoth for the quick replies. Will keep an eye out for what y'all decide.

eskimoquinn avatar Mar 14 '25 19:03 eskimoquinn

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 14 '25 00:05 github-actions[bot]

MDEditor.Markdown

I noticed the same issue today and the discrepancy in rendering of announcements was a surprise. This would be quite helpful

praphull-purohit avatar May 15 '25 08:05 praphull-purohit

pinging @awanlin who offered to follow up on this one

BethGriggs avatar May 20 '25 15:05 BethGriggs

@04kash is currently building the frontend of a new plugin, "morgue", using mdEditor: https://github.com/backstage/community-plugins/issues/2577#issuecomment-2840733548

I think that it would be great to have a bit of consistency between this work-in-progress plugin and Announcements plugin

gaelgoth avatar May 21 '25 15:05 gaelgoth

@kurtaking @gaelgoth any updates or news on this?

awanlin avatar Jun 17 '25 14:06 awanlin

Hey @awanlin,

I created a PR that allows setting either the MDEditor or the Backstage one for markdown rendering: https://github.com/backstage/community-plugins/issues/3187

gaelgoth avatar Jun 20 '25 14:06 gaelgoth

Latest release will include the fix for this.

kurtaking avatar Jun 25 '25 16:06 kurtaking

For those interested, in the latest version, you can now set md-editor to get the same Markdown rendering as the editor. More details can be found in the documentation

gaelgoth avatar Jun 26 '25 06:06 gaelgoth