cogentapps / chat-with-gpt

An open-source ChatGPT app with a voice
https://www.chatwithgpt.ai
MIT License
2.31k stars 493 forks source link

[Bug] Listing number with code blocks always starts with 1 #47

Closed LaChimere closed 1 year ago

LaChimere commented 1 year ago

When letting it answer many code blocks, the listing number is always 1 as below:

image

Nishad-007 commented 1 year ago

could you provide the code behind this render , this will help to solve the issue

LaChimere commented 1 year ago

could you provide the code behind this render , this will help to solve the issue

I'm not really familiar with React but I suppose app\src\components\markdown.tsx might give some hints.

cogentapps commented 1 year ago

Fixed by https://github.com/cogentapps/chat-with-gpt/commit/216ecd5b32da3d0c1ca4746b5d826db36c66ae36 - will roll out in the next few days.

Basically, the code blocks are causing the markdown renderer (react-markdown) to treat each list item as a separate list and generate separate <ol> elements, which resets the number. This fix makes it use the correct number.

LaChimere commented 1 year ago

Fixed by 216ecd5 - will roll out in the next few days.

Basically, the code blocks are causing the markdown renderer (react-markdown) to treat each list item as a separate list and generate separate <ol> elements, which resets the number. This fix makes it use the correct number.

Cool, thanks. This issue will be closed.