Unable to use markdown attribute lists with "text" element
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
- Attribute lists should work with text controls
- 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
- [X] I have checked the existing issues.
- [ ] I am willing to work on this issue (optional)
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;
}
@arcanaxion in which repo/branch should I search for this to contribute my solution pls help
Kindly assign it to me I want to fix it
@yashpal2104 Thank you for your help.
There's already a solution that will be proposed by R&D team soon. You'll be able to add style to page (available in 4.0) or even components (4.1 I guess) I think this should be removed from HacktoberFest @jrobinAV
oh okay happy to know you did find the solution, no worries I will try on some other good first issues. Thank you for informing about this @FredLL-Avaiga
@FredLL-Avaiga OK. Thank you.
There's already a solution that will be proposed by R&D team soon. You'll be able to add style to page (available in 4.0) or even components (4.1 I guess)
Hi @FredLL-Avaiga. Is this feature available yet? Specifically I want to specify the text colour hex code in a text component
it is for pages in 4.0 It's coming in 4.1 for components
@FredLL-Avaiga I see, thank you. For posterity, is this the page style feature you are referring to? https://docs.taipy.io/en/develop/refmans/reference/pkg_taipy/pkg_gui/pkg_builder/Page/#taipy.gui.builder.Page.set_style
yes and it is supported as well in the page constructor
ex: Markdown("""...""", style={...})