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

markdown: <TOC/> component, fix #1275 [WIP] #1307

Closed
wants to merge 11 commits into from

Conversation

shigma
Copy link
Collaborator

@shigma shigma commented Feb 17, 2019

Summary

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of default theme, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

You have tested in the following browsers: (Providing a detailed version will be better.)

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
  • Related documents have been updated
  • Related tests have been updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

  • Be compatible with old [[TOC]] syntax while enable new syntax <TOC/>. You can configurate TOC in markdown.toc or by directly passing props to <TOC/> component.
  • BREAKING: slugify, format and forceFullToc are not supported at present.
  • Documentation has been updated as well.

@shigma shigma mentioned this pull request Feb 18, 2019
1 task
@shigma shigma changed the title markdown: TOC component, fix #1275 [WIP] markdown: <TOC/> component, fix #1275 Feb 18, 2019
@shigma
Copy link
Collaborator Author

shigma commented Feb 19, 2019

@ulivz could you have a review on this? The original issue is marked as contribution welcome.

Copy link
Member

@ulivz ulivz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the great work, but I don't want to introduce so much code to fix this issue.

@shigma
Copy link
Collaborator Author

shigma commented Feb 19, 2019

Thanks for the great work, but I don't want to introduce so much code to fix this issue.

😢 I thought those addition could be compromised by removing a dependency.

@ulivz
Copy link
Member

ulivz commented Feb 19, 2019

Another solution is that you can transform your code changes into an internal plugin, for now the code are too dispersed.

@shigma
Copy link
Collaborator Author

shigma commented Feb 19, 2019

@ulivz I added TOC into built-in-components. What badge do you plan for the TOC component?

@shigma shigma changed the title markdown: <TOC/> component, fix #1275 markdown: <TOC/> component, fix #1275 [WIP] Feb 19, 2019
@shigma
Copy link
Collaborator Author

shigma commented Feb 19, 2019

Breaking Changes and Migrations

slugify

  • use markdown.slugify instead.

format

  • currently not supported by $page.headers.
  • also we cannot transfer function from server to client.
  • future solutions: markdown.format: function for formatting headings.

forceFullToc

  • currently not supported by $page.headers.

@shigma shigma closed this Feb 28, 2019
@shigma shigma deleted the toc-component branch February 28, 2019 16:30
@lunaceee
Copy link

I'm not sure if this is relevant but before I create a new issue I'd like you guys to verify my question first:

I'd like to add a toc to the site level, instead of adding it to each markdown file.

I tried adding
<TOC :list-type="['ol', 'ul']"><p slot="header"><strong>Custom Table of Contents</strong></p</TOC>
to the Layout.vue file, got the following error message:
<TOC> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

Any suggestions are highly appreciated!

@shigma
Copy link
Collaborator Author

shigma commented Mar 20, 2019

@lunaceee I think it's not our problem.

https://www.meteorlxy.cn/posts/2018/11/06/koa-core-read-source-code-part-3.html

You see, this is a website powered by VuePress, which indeed has a TOC on the site level, and it works well.

@lunaceee
Copy link

Thanks @shigma, this is really helpful!

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

Successfully merging this pull request may close these issues.

3 participants