-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Define Headers to Parse during Page Prep - resolve #984 #1004
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also update packages/@vuepress/markdown-loader/index.js
.
@ulivz Updated. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work. there is only an issue.
You support the feature in the core, but put the configuration under themeConfig, which is unreasonable. Only these options handled by the theme should be placed under themeConfig.
Put this option under siteConfig.markdown
would be better.
No worries. That makes sense. I will update this tonight/tomorrow and get some updates to you |
Sorry, Holidays got in the way... Update coming |
@ulivz updated. I had to gain access to the config, and I think this is the best way to do it. Maybe all of this should be extracted out to a |
@ulivz wondered if you had a chance to take a look at this. We are getting closer to needing this feature in our development. |
Would it be possible to get this into |
let config = loadConfig(path.resolve(sourceDir, '.vuepress'), false) | ||
if (isFunction(config)) { | ||
config = config(this) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't re-load user's config at the scope of makrdown-loader, while this loader should only focus on how to transpile the source markdown file to Vue component.
extractHeaders
should be a option for this loader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ill do some more digging, but I couldn't find any way to get to the extractHeaders
option from within this file already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you saying it should be available already inside of the loader file if defined in the .vuepress/config.js
file such as:
module.exports = ctx => ({
markdown: {
extractHeaders: ['h2','h3','h4','h5']
}
})
if that is the case, I have looked at the this
object and could not find it anywhere.
04f50a4
to
edcf194
Compare
This reverts commit 06465e1.
…nto page_header_parsing
@ulivz This last rebase caused a bunch of issues in this PR changed files list. I have updated to include I can make a new PR, based on the changes here that is a bit cleaner, bit it seems it won't let me clean up this PR for some reason. Any chance we can get this into the next release (hopefully before the new year)? |
316e022
to
1284944
Compare
To avoid wasting your time, I recommend that this feature be implemented by official collaborators. |
@ulivz: And, how would one (Okta and Myself) become an official collaborator for VuePress on an open source tool? I am pretty sure this was not wasting my time as I was trying to donate my time to help expand this project. |
So is this is abandoned and not implemented? |
@knyttl this was handled through #1945 |
Summary
This PR resolves #984
Currently the header parsing is hard coded to
['h2', 'h3']
. This code changes that to give the ability to configure this in thethemeOptions
config.What kind of change does this PR introduce? (check at least one)
If changing the UI of default theme, please provide the before/after screenshot:
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
fix #xxx[,#xxx]
, where "xxx" is the issue number)You have tested in the following browsers: (Providing a detailed version will be better.)
If adding a new feature, the PR's description includes:
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: