-
Notifications
You must be signed in to change notification settings - Fork 61.8k
Tab widget (prototype) #1606
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
Tab widget (prototype) #1606
Conversation
@Simran-B i didn't understand what you mean to say? As i am a beginner I don't know much about open source. |
@himanshu211raj Do you know JavaScript? If yes, then you can help me here. If no, then you can still help to add more examples (for example PowerShell scripts where currently only Bash examples are given). Or do you want to help with something else? |
Where i can help in adding more examples and in which other domains i will make contributions and how? |
@himanshu211raj The "Setting an environment variable" example only works in a Bash shell for instance: You could add additional examples for PowerShell Core and Windows If you are not familiar with PowerShell and |
This PR is stale because it has been open 7 days with no activity and will be automatically closed in 3 days. To keep this PR open, update the PR by adding a comment or pushing a commit. |
Thanks so much for opening a PR @Simran-B! I'll get this triaged for review 💖 |
@janiceilene Thanks, but this PR is still in draft state, i.e. too early for a review. I wanted to share my work in progress code so that others have a chance to help. I would appreciate early feedback nonetheless. There are a couple of issues at the moment:
|
Thanks for the clarification @Simran-B! I moved it over to where the engineering team can take a look with that additional context 💖 |
This PR is stale because it has been open 7 days with no activity and will be automatically closed in 3 days. To keep this PR open, update the PR by adding a comment or pushing a commit. |
This PR is stale because it has been open 7 days with no activity and will be automatically closed in 3 days. To keep this PR open, update the PR by adding a comment or pushing a commit. |
Notes to self:
|
This PR is stale because it has been open 7 days with no activity and will be automatically closed in 3 days. To keep this PR open, update the PR by adding a comment or pushing a commit. |
Still experimenting with this locally, making it cleaner and more robust. Note to self: check what causes the unwanted Markdown processing of the HTML template and find a way to avoid it. |
@Simran-B thank you for continuing to experiment with this! I'm following along and looking forward to using this new widget in the docs. |
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.
@Simran-B A general-usage tab component has been on our radar for a while, so thank you for making it happen! This is looking great so far!
In terms of implementation, I know this is still early stage, but I am curious if you have considered a nested block approach, instead of the current liquid tag within a liquid block approach? I think this will result in modular and more maintainable code. From a usability perspective, a nested liquid block usage might be more user-friendly as well:
{% tabs "shell" %}
{% tab "Bash" %}
bash stuff
{% endtab %}
{% tab "PowerShell" %}
powershell stuff
{% endtab %}
{% endtabs %}
I am happy to elaborate some more if it's helpful. Please let me know how I can support you to get this to the finish line!
lib/liquid-tags/tabs.js
Outdated
this.tabs.forEach(async tab => { | ||
// Could use textOnly mode to strip out markup, but slugger does that and more, see pushBlock() | ||
//await renderContent(tab.title, null, { textOnly: true }) | ||
tab.title = (await renderContent(tab.title, null)).slice(3, -4) // HACK: remove surrounding <p> |
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.
👍🏼 on slugger usage here! It's a good idea to support markdown in the tab header, but I think if we do, we should also support parsing variables/reusables here as well to be consistent. context
will need to be passed in for the variables/reusables to be rendered properly. We could rearrange the order of calling these methods a bit:
tab.title = (await renderContent(tab.title, null)).slice(3, -4) // HACK: remove surrounding <p> | |
tab.title = slugger.slug(await renderContent(tab.title, context)) |
This PR is stale because it has been open 7 days with no activity and will be automatically closed in 3 days. To keep this PR open, update the PR by adding a comment or pushing a commit. |
Hi @vanessayuenn, thanks for the feedback. I missed your comment among all the notifications (and there are frequent spam comments in this repo unfortunately). Sorry for getting back so late.
I did, but the markup looks somewhat cleaner with tags and it (mostly) solves a particular problem: What to do with content between tab blocks? For example:
With tabs as tags, only one corner case remains:
From a usability point of view and especially with larger amounts of tabbed content, I can see how tab blocks would be better however. I'll see if I can intercept the callbacks for the content to throw an error if there's something outside of tab blocks. |
…offset in the viewport
…text to interpreted as Markdown code block
This PR is stale because it has been open 7 days with no activity and will be automatically closed in 3 days. To keep this PR open, update the PR by adding a comment or pushing a commit. |
@vanessayuenn Regarding nested blocks, are there any existing examples? Registering both If there's no built-in functionality for nested block handling, then I'm not sure how to progress. The parser code is pretty daunting. |
@Simran-B sorry we've taken so long to get back to you on this. 🙇🏿 We're not going to move forward in this direction but we appreciate your contribution! Thanks for the time and effort you invested in this PR. |
@chiedo No problem. I'd still like to know if it's a general decision against tabs and whether you have an alternative in mind. #2121 depends on a solution IMO, because adding a headline for every example (one per shell type) is messy. I'll probably work on this further as an exercise when I find the time, as I need such a widget myself (for Jekyll, but I'm more comfortable with JavaScript than Ruby, so this is great for experimentation especially because the Liquid renderer is basically a port). |
👋🏼 @Simran-B we aren't currently planning to expand our tabs in docs, but this is helpful feedback for future docs changes. If you're still interested in working on the problem stated in #253, adding Windows-specific examples in areas where they're missing in a PR would be a welcome addition as Lucas mentioned in this comment 💜 Thanks so much for your contributions and passion for GitHub Docs! |
* Update action text for PR * rephrase * rephrase
See #253
npm run dev
to start server, then openhttp://localhost:4000/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions
in browser.