-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Title in block quotes are displayed in the sidebar #1951
Comments
Hi @noraj , you can use |
|
Now, we treat those contents which are marked as title (## H2) to sidebar since it's based on markdown syntax. If u have lots of cases like this, I suppose you could write a hook/plugin to rewrite those titles with ignore tags instead. |
If you need to use bold, you can use |
Those are not But I can see the markdown parser used here is marked but in a pretty old version (1.2.9 while the last is 4.2.5) Line 68 in a8f9fc1
so maybe things have changed since then? Or this is maybe due to the fact that marked is not a true parser that parse the syntax but rather use regexp to do so and so is not aware of the context (cf. https://github.com/markedjs/marked/blob/master/src/rules.js and markedjs/marked#1549). If this is due to the broken way of marked to parser markdown I would then suggest to move to a more robust, true parser and commonmark compliant parser like https://github.com/markdown-it/markdown-it or https://github.com/commonmark/commonmark.js.
The point of a blockquote is to copy a content and paste it as it, since it's a quote you don't rewrite the 3rd party content. So changing all title to bold just because the sidebar as a bug is not a solution. |
Hi @noraj . In here parser by github. e.g
h2We can see the blockquote one is same to And about the parser such as Generally we should follow the common markdown parser behavior and we can and have exposed hooks and other ways to let user have access to handle it if needs to, otherwise docsify should create its own parser to refine the whole content beyond the markdown syntax (such as filter those specific Maybe it gonna be enhanced into docsify when the |
Yeah of course h2 in blockquotes are rendered as h2 and are see by the user user as h2 (in a blockquote). I don't think there is any need of a custom parser. ## h2
> ## h2 Produces: <h2>h2</h2>
<blockquote>
<h2>h2</h2>
</blockquote> h2 in blockquotes would be rendered as is (untouched) in the page but it's just that the content of For example Hexo SSG use Marked as default renderer but is also compatible with markdown-it. It's as a toc helper. Their toc helper will ignore titles in blockquotes. Here is the code of the toc helper https://github.com/hexojs/hexo/blob/master/lib/plugins/helper/toc.js. The toc helper uses a Maybe this is a good example and this can help. |
Hi @noraj , yep. I agree that docsify should handle some general cases of sidebar. For current case the blockquote with title marks, as I mentioned, docsify treats all the FYI, the solution that I recommend to handle this case with hook below. About the time when docsify gonna handle this case by itself I m sorry that I can not say an exact time for now. hook.beforeEach((markdown) =>
markdown.replace(/(\s{0,3}> #+.*)/g, '$1 {docsify-ignore} ')
); |
We can create a custom js to render the headings to add that |
Bug Report
Steps to reproduce
Put a markdown title in a quote.
What is current behaviour
Title inside Block quotes are rendered to the sidebar menu.
What is the expected behaviour
Title inside Block quotes should not be listed in the sidebar.
Other relevant information
Bug does still occur when all/other plugins are disabled?
Your OS: ArchLinux
Node.js version: 19.3.0
npm/yarn version: N/A
Browser version: 19.3.0
Docsify version: 4.13.0
Docsify plugins: N/A
Please create a reproducible sandbox
Mention the docsify version in which this bug was not present (if any)
None
The text was updated successfully, but these errors were encountered: