-
Notifications
You must be signed in to change notification settings - Fork 650
Add a sidebar nav to tutorial pages #1156
Comments
@zeke , I would like to work on the sidebar nav! |
@sharadshriram cool! I think a first step would be updating https://github.com/electron/electron-i18n to extract the locaized TOC lists from |
@zeke I'm helping @sharadshriram in this. We are from the same uni and can collaborate. Update: This is what I understand until now: //access the directory
const basePath = path.join(__dirname, '..', 'content')
const contentPath = (lang) => path.join(basePath, lang, 'docs')
langs.forEach((lang) => {
//call the function getNavbarContent(lang)
}
async function getNavbarContent (lang) {
//extract data from Readme's
//somehow add these localized TOCs
// to i18n object (not sure how yet - as a separate attribute within docs perhaps)
} Later export it as i18n object in the electronjs.org website: const i18n = require('electron-i18n') @zeke Let me know if I'm thinking in the right direction. |
That's close, though the I would recommend writing a standalone script that is required and used from the const cheerio = require('cheerio')
function getTableOfContents(locale)
const doc = docs[locale]['docs/README.md']
const html = doc.sections.map(section => section.html).join('\n')
const $ = cheerio.load(html)
const heading = $('a[href="#guides-and-tutorials"]').parent() // h2
const toc = heading.next('ul').html()
} ☝️ This is definitely not exactly right, but hopefully it helps you move forward. Let me know! |
@zeke newbie node.js doubt Then, I thought okay let me just try to run this standalone, so I did I tried running Checked environment paths, deleted node_modules and reinstalled them by now. |
I'm offline for a bit, but will help you move this forward when I'm back. Thanks for being patient! |
@zeke Any hints? |
@Shivam-Miglani do you have any time this week to join a video call? We can work on this together if you like. |
@zeke Except for a couple of hour of lectures, I can join a video call Mon(today), Tue and Wed. I am not free around 13:00-16:00 (CEST timezone: GMT+2) on Tue and Wed. Anytime apart from that is cool. |
How about 17:30 CEST Tuesday? |
Yes, works for me. |
@Shivam-Miglani please email me at zeke@github.com and I'll send you a calendar invitation. |
For the record, @Shivam-Miglani and I had a call today. Shivam is going to work on opening a PR to i18n that adds parsed navs for every language. |
Next step? |
Now that electron/i18n#295 has landed in a release, we can display it on the site. #1220 is a start. |
Don't know if this helps, but my 2017 gist hack still works: #604 (comment) The gist: electron-doc-read-help.js |
This is a followup to electron/electron#11416
@felixrieseberg wrote a bunch of tutorial content and created a nice table of contents in electron/electron#11966
Now that we have that, let's display it in a sidebar on tutorial pages, so people can navigate their way through the tutorial content more easily.
The text was updated successfully, but these errors were encountered: