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

[Question] Is there a way to express the markdown string that changes by State? #293

Closed
Iced0368 opened this issue Jan 20, 2023 · 1 comment · Fixed by #392
Closed

[Question] Is there a way to express the markdown string that changes by State? #293

Iced0368 opened this issue Jan 20, 2023 · 1 comment · Fixed by #392
Labels
bug Something isn't working
Milestone

Comments

@Iced0368
Copy link

Iced0368 commented Jan 20, 2023

As far as I know, pc.markdown get value as only string.

So if i compile this code,

class State(pc.State):
    text: str = "**Bold Text**"

    def get_some_markdown_string_from_db(self):
        #Blah Blah
        self.text = "Some-Markdown-String"

def index():
    return pc.container(
        pc.markdown(State.text),
        pc.button(on_click = State.get_some_markdown_string_from_db)
    )

Unlike my expectation, sadly I got error because mState.text is not a string, but State variable.

But I want to get the strings written in markdown to State from db and display them in the markdown form.

Is there any way to implement this?

@Alek99
Copy link
Member

Alek99 commented Jan 20, 2023

Ah ok we can fix this, looks like we need to make it accept var type as well. Thanks for pointing this out

@Alek99 Alek99 added the bug Something isn't working label Jan 20, 2023
@picklelo picklelo added this to the v0.1.14 milestone Jan 23, 2023
@Alek99 Alek99 linked a pull request Jan 30, 2023 that will close this issue
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants