Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enableMarkdownInDescription does not work in parent elements of if description is above input element #3975

Open
4 tasks done
quazgar opened this issue Nov 27, 2023 · 6 comments

Comments

@quazgar
Copy link

quazgar commented Nov 27, 2023

Prerequisites

What theme are you using?

material-ui

Version

5.x / current playground

Current Behavior

As demonstrated in this playground instance, enableMarkdownInDescription only seems to work in leaf nodes, not in higher levels of the json schema tree.

Expected Behavior

enableMarkdownInDescription should work everywhere.

Steps To Reproduce

Option 1: Look ath the playground example linked above.

Option 2:

  1. Add "ui:enableMarkdownInDescription": true to the ui schema definition in an element which has children.
  2. Add a description which should be rendered as Markdown.

Environment

Current playground.

Anything else?

No response

@quazgar quazgar added bug needs triage Initial label given, to be assigned correct labels and assigned labels Nov 27, 2023
@quazgar
Copy link
Author

quazgar commented Nov 29, 2023

@dejanbelusic @heath-freenome ping, because you seem to have been involved in #3665

@heath-freenome
Copy link
Member

@quazgar Good catch. I'm really busy and I do not have time to make a fix. If @dejanbelusic is unable to help, would you be willing to provide a PR to fix this?

@heath-freenome heath-freenome added help wanted uiSchema and removed needs triage Initial label given, to be assigned correct labels and assigned labels Dec 1, 2023
@quazgar
Copy link
Author

quazgar commented Dec 5, 2023

I am pretty busy myself, but maybe I can find a customer who needs this and is willing to pay, or a colleague might find the time.

@quazgar
Copy link
Author

quazgar commented Dec 7, 2023

New playground instance which shows that markdown also does not seem to work for descriptions which render above the input element (a boolean field in this case).

Schema

{
  "title": "A list of tasks",
  "type": "object",
  "properties": {
    "tasks": {
      "description": "*very* simple, but no Markdown",
      "type": "object",
      "title": "Tasks",
      "properties": {
        "details": {
          "type": "string",
          "title": "Task details",
          "description": "Description which renders Markdown *correctly*."
        },
        "has_Markdown": {
          "type": "boolean",
          "description": "Also *no Markdown*"
}}}}}

UI schema

{
  "tasks": {
    "ui:enableMarkdownInDescription": true,
    "ui:description": "New *description*, still no Markdown.",
    "details": {
      "ui:enableMarkdownInDescription": true,
      "ui:widget": "textarea"
    },
    "has_markdown": {
      "ui:enableMarkdownInDescription": true
}}}

@quazgar quazgar changed the title enableMarkdownInDescription does not work in parent elements enableMarkdownInDescription does not work in parent elements of if description is above input element Dec 13, 2023
@dejanbelusic
Copy link
Contributor

Hi @heath-freenome, I created a PR fixing this issue: #4405, you can take a look!

Hi @quazgar, sorry it took me this long to tackle this issue. I wish I could have done it sooner, hope it still brings you value.

@dejanbelusic
Copy link
Contributor

New playground instance which shows that markdown also does not seem to work for descriptions which render above the input element (a boolean field in this case).

Schema

{
  "title": "A list of tasks",
  "type": "object",
  "properties": {
    "tasks": {
      "description": "*very* simple, but no Markdown",
      "type": "object",
      "title": "Tasks",
      "properties": {
        "details": {
          "type": "string",
          "title": "Task details",
          "description": "Description which renders Markdown *correctly*."
        },
        "has_Markdown": {
          "type": "boolean",
          "description": "Also *no Markdown*"
}}}}}

UI schema

{
  "tasks": {
    "ui:enableMarkdownInDescription": true,
    "ui:description": "New *description*, still no Markdown.",
    "details": {
      "ui:enableMarkdownInDescription": true,
      "ui:widget": "textarea"
    },
    "has_markdown": {
      "ui:enableMarkdownInDescription": true
}}}

In the example you shared here, please note that in Shema you are using has_Markdown, but in UI schema it says has_markdown. These values are case-sensitive and should be the same. Please note that when testing the feature after my PR gets merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants