-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Code snippets not properly indented if included in numbered lists w/o empty newline #2057
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
Comments
Hi @adamlui , IIUC, it seems the md parser default syntax , either in github comments. i.e
Result (async () => {
const { chatgpt } = await import(chrome.runtime.getURL('lib/chatgpt.js'));
// Your code here...
})();
Result (async () => {
const { chatgpt } = await import(chrome.runtime.getURL('lib/chatgpt.js'));
// Your code here...
})(); |
Hey @Koooooo-7 I tested your theory and added 4 spaces after |
Yep. I meant that it seems the parser common behavior in both docsify and github as I pasted above, they have the same render result which make the 4 spaces to 1. If you wanna keep the |
@Koooooo-7 where should I insert the |
Normally, it should be in the html content. but in the case you mentioned, it seems not work :(. |
Actually your pastes render properly in GitHub as 4-space: Only in Docsify do code blocks without vertical space between numbered item header & code block as described do they become 1-space: Source: https://chatgpt.js.org/#/?id=-chrome On GitHub, this same markdown results in 4-space: Source: https://github.com/chatgptjs/chatgpt.js#-chrome The reason this glitch is occurring, there is logic in Docsify that strips extra whitespace down to 1-space to uniformly indent numbered items, but does not account for code blocks (which need more than 1 often) like GitHub does, so it needs to add a condition only if backticks aren't detected (not just newlines) |
Hi @adamlui , I final understand this now. I found that it is the Test on
|
It does properly indent when newline is added, but the gap between numbered heading and code block shrinks, so it doesn't look right is why I sacrificed and let just one code block look weird. Do you know when marked.js will be upgraded? |
Actually, we do discuss on the marked.js upgrade stuff and I already merge it #1993. But it may broken the support for |
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
When code snippets are included in numbered lists without an empty newline separating numbered heading & snippet, indents become single spaces:
Steps to reproduce
In the doc, write a code snippet after numbered item without using an empty newline:
What is current behaviour
4-space indents in code block become 1-space
What is the expected behaviour
4-space indents remain 4-space
Other relevant information
The bug is live @ https://chatgpt.js.org
While inserting an empty newline between the numbered item & the code block restores proper indentation, it strangely removes the vertical gap between the two when rendered, so omitting empty newline is less unpleasing aesthetically (relative to whole site vs. merely code blocks being off)
Bug does still occur when all/other plugins are disabled?
Your OS: Windows 10
Node.js version: 18.15.0
npm/yarn version: 9.5.0
Browser version: Firefox 111.0
Docsify version: 4.13.0
Docsify plugins:
Please create a reproducible sandbox
The codesandbox.io site keeps giving error when I try to upload files (https://github.com/chatgptjs/chatgpt.js/tree/main/docs)
Mention the docsify version in which this bug was not present (if any)
The text was updated successfully, but these errors were encountered: