Closed joisun closed 1 year ago
Hi, here you can see remark-toc
working as expected:
https://codesandbox.io/s/confident-volhard-dnnmtz?file=/src/app.tsx
You probably don't have "Table of Contents" in your file.
Hi, here you can see
remark-toc
working as expected: codesandbox.io/s/confident-volhard-dnnmtz?file=/src/app.tsxYou probably don't have "Table of Contents" in your file.
Okay ,thank you pretty much, I guess I've missed the doc :
options.heading Pattern text of heading to look for (string, default: 'toc|table[ -]of[ -]contents?'). Wrapped in new RegExp('^(' + options.heading + ')$', 'i'), so it’s case-insensitive and matches the whole heading text.
My render content do not contain "Table of Contents", there is only a "[toc]", which can use directlly in Typora.
By the way , Can I do some config to match "[toc]" content ? instead of Headling ?
and What I've tried as a Headling still not work:
...
## [toc]
...
with the headling config {headling:"\\[toc\\]"}
or {headling:"\[toc\]"}
Appreciate ! @Murderlon
Why are you wrapping toc
in []
? I would just use toc
, and with that: {heading: 'toc'}
(no regex).
https://github.com/remarkjs/remark-toc#example-a-different-heading
Hi! This was closed. Team: If this was fixed, please add phase/solved
. Otherwise, please add one of the no/*
labels.
Hi! Thanks for reaching out! Because we treat issues as our backlog, we close issues that are questions since they don’t represent a task to be completed.
See our support docs for how and where to ask questions.
Thanks, — bb
Why are you wrapping
toc
in[]
? I would just usetoc
, and with that:{heading: 'toc'}
(no regex).
I usually write post on typora, and the TOC rule here: https://support.typora.io/Markdown-Reference/
Enter [toc] and press the Return key to create a “Table of Contents” section. The TOC extracts all headings from the document, and its contents are updated automatically as you add to the document.
so it's convenient for me to copy the content directly without change.
and I've tried succesfully like this: https://codesandbox.io/s/priceless-ben-65h2mc?file=/src/app.tsx
But, is there anyway to match body content instead of Headling?
# match this
[toc]
# instead of this
## [toc]
But, is there anyway to match body content instead of Headling?
No it has to be a heading. But you can fork this plugin and adjust it where needed.
But, is there anyway to match body content instead of Headling?
No it has to be a heading. But you can fork this plugin and adjust it where needed.
Okay, thanks again
Initial checklist
Affected packages and versions
Link to runnable example
No response
Steps to reproduce
I'm writting a ArticleViewer React Component , and used remark-toc as a plugin , expect to generate Table of content for me. But it's not working...
Expected behavior
remark-toc work well
Actual behavior
-
Runtime
No response
Package manager
No response
OS
No response
Build and bundle tools
No response