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

Better default markdown support #665

Closed
adriens opened this issue Jul 24, 2024 · 10 comments
Closed

Better default markdown support #665

adriens opened this issue Jul 24, 2024 · 10 comments
Assignees

Comments

@adriens
Copy link

adriens commented Jul 24, 2024

❔ About

I use mesop to interact with an AI Agent API that is able to reply complex markdown... with lists and sub-items... but when display its answers I got sub-item appearing at the wrong level :

image

In other words, sections are messed-up and all go to the same level

🙏 Feature request

Make mesop better handle list and sublists.

For now, the only workaround I foud is to asj my agent to reply in markdown in raw format... causing the final display to be right but properly displayed (I have to copy/paste it into any markdown previewer to enjoy it).

@richard-to
Copy link
Collaborator

Thanks for pointing that out. As an experiment I've been thinking of creating a web component that renders markdown on the client side, which I think could improve #591.

So first I want to try it as a web component to see if it works. And if it does work, I think we could update the core markdown component to also render markdown on the front end.

So it's possible using the markdown web component could render the markdown better.


On the other hand, it is strange that the markdown is not being rendered correctly for you, especially a simple thing like nested lists. I'll see if I can reproduce it.

Do you have an example output for testing?

@richard-to
Copy link
Collaborator

richard-to commented Jul 24, 2024

Yeah I can confirm that the sub list is not working. This can be seen also in the demo gallary for the markdown example. The sublist is not indented.

It looks like a rendering issue since it gets rendered a one level list and not nested.

@richard-to
Copy link
Collaborator

So looks like the reason is the markdown module we're using requires four space indention. See Python-Markdown/markdown#1378

This is expected behavior for this module.


I'd agree that this isn't ideal. As a workaround is it possible to tell the agent to render the sublist with four spaces?

@adriens
Copy link
Author

adriens commented Jul 24, 2024

I'd agree that this isn't ideal. As a workaround is it possible to tell the agent to render the sublist with four spaces?

In my case, I asked my agent to generate a markdown so I can put it in Github issue... and let him do the job.

@richard-to
Copy link
Collaborator

We're planning to update the markdown object to render using javascript instead of python. This has the side effect of allowing two spaces for nested lists.

@adriens
Copy link
Author

adriens commented Aug 21, 2024

great news ! We did a demo yesterday and enjoyed a lot the Dark theme toggle btw. I made an internal issue to force markdown output... so we'll wait for the next release.

Thanks for the very cool feedback and the resulting devex 🙏

@adriens
Copy link
Author

adriens commented Aug 21, 2024

here is the yesterday pari-programming session :

@richard-to
Copy link
Collaborator

Just for clarification, we haven't finished the implementation yet for the markdown rendering change. I'll probably start on that this week. And in reference to #816, we should have a copy and paste button.

@adriens
Copy link
Author

adriens commented Aug 21, 2024

I'll probably start on that this week

No rush, no pressure 🙏

@richard-to
Copy link
Collaborator

Closing this issue. We updated the markdown to frontend rendering which supports github flavored markdown. Ref: #930

So this should be available in the next release of Mesop.

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

No branches or pull requests

2 participants