forked from xyield/xrpl-go
-
Notifications
You must be signed in to change notification settings - Fork 18
[TA-5120] Add Separators & labels to sections #155
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8f1683a
feat(docs): add custom sidebarLabelGenerator to add labels in autogen…
banasa44 eec3827
fix(docs): correct formatting in changelog and update sidebar position
banasa44 ee73fbe
fix(docs): add comment to clarify changelog path update requirement
banasa44 64a0df9
Merge branch 'feat/docs/add-changelog' into feat/docs/add-separators-…
banasa44 f36a005
fix(docs): sidebarSectionLabel styles
GuillemGarciaDev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| --- | ||
| sidebar_position: 0 | ||
| sectionTopLabel: Introduction | ||
| sectionBottomLabel: Versions | ||
| --- | ||
|
|
||
| # Changelog | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| --- | ||
| sidebar_position: 1 | ||
| sectionTopLabel: Introduction | ||
| --- | ||
|
|
||
| # Getting Started | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| --- | ||
| sidebar_position: 5 | ||
| pagination_next: xrpl/currency | ||
| sectionTopLabel: Packages | ||
| --- | ||
|
|
||
| # keypairs | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /** | ||
| * Custom sidebar items generator that injects “top” and “bottom” section labels | ||
| * around individual docs based on front-matter flags. | ||
| * | ||
| * To use, add these to the **YAML front-matter** of your Markdown file (no quotes needed): | ||
| * | ||
| * ```md | ||
| * --- | ||
| * title: Changelog | ||
| * sectionTopLabel: Introduction # injects “Introduction” above this doc | ||
| * sectionBottomLabel: Versions # injects “Versions” below this doc | ||
| * --- | ||
| * ``` | ||
| * | ||
| * @param args | ||
| * - defaultSidebarItemsGenerator: function to produce the normal sidebar items | ||
| * - docs: array of all doc metadata (including your frontMatter) | ||
| * @returns | ||
| * A new array of sidebar items, with `<div class="sidebar-section-label">…</div>` | ||
| * injected before/after any doc that defines `sectionTopLabel` or | ||
| * `sectionBottomLabel` in its front-matter. | ||
| */ | ||
| export async function sidebarLabelGenerator(args) { | ||
| const defaultItems = await args.defaultSidebarItemsGenerator!(args); | ||
| return defaultItems.flatMap((item) => { | ||
| // only modify real docs (skip categories, html, etc.) | ||
| if (item.type === "doc") { | ||
| const docMeta = args.docs.find((d) => d.id === item.id); | ||
| const { sectionTopLabel, sectionBottomLabel } = | ||
| docMeta?.frontMatter || {}; | ||
| const out = []; | ||
|
|
||
| // If the front-matter had a sectionTopLabel, inject it above | ||
| if (sectionTopLabel) { | ||
| out.push({ | ||
| type: "html", | ||
| value: `<div class="sidebarSectionLabel">${sectionTopLabel}</div>`, | ||
banasa44 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| defaultStyle: true, | ||
| }); | ||
| } | ||
|
|
||
| out.push(item); | ||
|
|
||
| // If the front-matter had a sectionBottomLabel, inject it below | ||
| if (sectionBottomLabel) { | ||
| out.push({ | ||
| type: "html", | ||
| value: `<div class="sidebarSectionLabel">${sectionBottomLabel}</div>`, | ||
| defaultStyle: true, | ||
| }); | ||
| } | ||
|
|
||
| return out; | ||
| } | ||
|
|
||
| return [item]; | ||
| }); | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.