Allow an array of globs for the globs option#1118
Conversation
4a67349 to
10395a9
Compare
|
@yash-chowdhary could I get your review here? The functional changes are summarised by this line |
Yes, I think this would be good. It would solve the same issue of repeated configuration. Unless there was a reason for making it a per-file configuration? Otherwise, LGTM! |
No objections from me |
The site configuration does not allow using an array for specifying pages in the src or glob property. The method for collecting the addressable pages can also be made slightly simpler in the process. Let’s do so, reducing the amount of repeated configuration the author potentially needs to write. Let’s also simplify the method for collecting addressable pages in the process.
| this.addressablePages = pages.filter(page => page.src); | ||
| const pagesFromSrc = _.flatMap(pages.filter(page => page.src), page => (Array.isArray(page.src) | ||
| ? page.src.map(pageSrc => ({ ...page, src: pageSrc })) | ||
| : [page])); |
There was a problem hiding this comment.
Thanks for the feedback and reviews! @yash-chowdhary @damithc @marvinchin
Yeah, this looks good to me 🚀 Supporting an array of src sounds great as well! Let's do it in another PR?
My bad, pushed this before seeing this message. Its just a three line change here ^ though, let me know if it should be in a separate PR!
There was a problem hiding this comment.
Its just a three line change here ^ though, let me know if it should be in a separate PR!
I think it can be left in this PR. 👍
…bind into remove-fixed-bugs * 'remove-fixed-bugs' of https://github.com/Tejas2805/markbind: Docs: Add contributing.md (MarkBind#1139) Show pointer and use underline dashed for click trigger (MarkBind#1111) Support variables to be defined as by JSON (MarkBind#1117) Allow an array for specifying page src or glob (MarkBind#1118) Code blocks: Implement inline markdown support for heading (MarkBind#1137) Fix lazy reload for urls without index (MarkBind#1110) Changes remaining references from filterTags to tags (MarkBind#1149)
The site configuration does not allow using an array for specifying pages in the src or glob property. The method for collecting the addressable pages can also be made slightly simpler in the process. Let’s do so, reducing the amount of repeated configuration the author potentially needs to write. Let’s also simplify the method for collecting addressable pages in the process.
What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [x] Documentation update
• [x] Enhancement to an existing feature
Resolves #789
What is the rationale for this request?
Allow authors to specify an array of globs for the
globsoption, which can help reduce repeated configurationWhat changes did you make? (Give an overview)
reduce - concatmethod of collecting pages with globs andwalkSyncusingflatMapinstead.collectAddressablePagessite.jsonfor test sites / docs and update test files accordingly.siteData.json's page entries order was swapped due towalkSyncnow collecting the pages from all globs in the array simultaneously. ( the properties remain the same though )Provide some example code that this change will affect:
Is there anything you'd like reviewers to focus on?
Should we allow this forsrcas well?Testing instructions:
npm run testshould pass ( existingsite.jsonfor docs and test sites were updated to use new syntax )Proposed commit message: (wrap lines at 72 characters)
Allow an array for specifying page src or glob
The site configuration does not allow using an array for specifying
pages in the src or glob property.
The method for collecting the addressable pages can also be
made slightly simpler in the process.
Let’s do so, reducing the amount of repeated configuration the
author potentially needs to write.
Let’s also simplify the method for collecting addressable pages
in the process.