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

Unable to use markdown attribute lists with "text" element #1781

Open
1 of 4 tasks
arcanaxion opened this issue Sep 12, 2024 · 1 comment
Open
1 of 4 tasks

Unable to use markdown attribute lists with "text" element #1781

arcanaxion opened this issue Sep 12, 2024 · 1 comment
Labels
🖰 GUI Related to GUI 💥Malfunction Addresses an identified problem. 🟨 Priority: Medium Not blocking but should be addressed 🔒 Staff only Can only be assigned to the Taipy R&D team

Comments

@arcanaxion
Copy link

What went wrong? 🤔

Per title, cannot use attribute lists with text, since Taipy tries to evaluate the content of the curly braces: https://python-markdown.github.io/extensions/attr_list/

from taipy.gui import Gui, Markdown
import taipy.gui.builder as tgb

with tgb.Page() as page_tgb:
    tgb.text("This is a **Taipy**{: style='color:red'} application.")

page_md = Markdown(
"""
<|This is a **Taipy**{: style='color:red'} application.|text|>
""")

if __name__ == "__main__":
    page = page_tgb
    gui = Gui(page)
    gui.run(debug=True, run_browser=False, use_reloader=True)

Both page_tgb and page_md fail with the traceback:

  File "<unknown>", line 1
    : style='color:red'
    ^
SyntaxError: invalid syntax

<|Hello|text|> translates to tgb.text("Hello"). How do you represent "normal" text not in a text element, like in the page_md example above?

E.g. the following example (seemingly) only available with the markdown syntax, works:

page_md_working = Markdown(
"""
This is a **Taipy**{: style='color:red'} application.
""")

Expected Behavior

  1. Attribute lists should work with text controls
  2. tgb syntax should have a way to display text without using the text element, like what is possible with the markdown syntax

Steps to Reproduce Issue

NA

Solution Proposed

NA

Screenshots

NA

Runtime Environment

No response

Browsers

No response

OS

No response

Version of Taipy

No response

Additional Context

No response

Acceptance Criteria

  • Ensure new code is unit tested, and check code coverage is at least 90%.
  • Create related issue in taipy-doc for documentation and Release Notes.

Code of Conduct

  • I have checked the existing issues.
  • I am willing to work on this issue (optional)
@arcanaxion arcanaxion added the 💥Malfunction Addresses an identified problem. label Sep 12, 2024
@FlorianJacta
Copy link
Member

As a workaround, I put these texts as bold in my application, and I use CSS to change the color of all bold texts to show a different color.

strong, b {
    font-weight: bold; /* This is equivalent to 700 */
    color: #ff6049;
}

@jrobinAV jrobinAV added 🖰 GUI Related to GUI 🔒 Staff only Can only be assigned to the Taipy R&D team 🟨 Priority: Medium Not blocking but should be addressed labels Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖰 GUI Related to GUI 💥Malfunction Addresses an identified problem. 🟨 Priority: Medium Not blocking but should be addressed 🔒 Staff only Can only be assigned to the Taipy R&D team
Projects
None yet
Development

No branches or pull requests

3 participants