Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
51933cb
sitemap config
addshore Sep 5, 2025
0fc9247
Rework the device API, protocol and message page layouts
addshore Sep 5, 2025
94157a4
Intro to device messaging changes
addshore Sep 5, 2025
af64f1a
Add favicons
addshore Sep 12, 2025
bc780bf
A first pass on RTK improvements
addshore Sep 12, 2025
acf264e
More spec downloads + booklet for rh2
addshore Sep 12, 2025
e76e62b
link more spec terms
addshore Sep 12, 2025
9dc861f
RH2 has ESP32-C6
addshore Sep 12, 2025
f5e0ea9
fix RH2 STM & Link datasheet urls
addshore Sep 12, 2025
29fd5e6
rtk: Section on correction data
addshore Sep 12, 2025
b90463c
Use a single image for VT3 install tools
addshore Sep 12, 2025
5b3b5ee
admin: Split all devices doc pages
addshore Sep 12, 2025
cccac34
Add RTK admin portal basic docs
addshore Sep 12, 2025
a9d6645
Fix links in spec PDF render
addshore Sep 12, 2025
c0d5d3d
Merge branch 'production'
addshore Sep 15, 2025
e87340e
Don't use archive.org on history page
addshore Sep 15, 2025
e72d7be
Rework make devices page
addshore Sep 17, 2025
1cdc8ca
Update device-specs/rtk/v2 from booklet
addshore Sep 17, 2025
cf33e8e
Add RH2 sub pages
addshore Sep 17, 2025
d4a1663
menu and link tweaks around sdk and rtk
addshore Sep 17, 2025
3e0cc41
shiki add toit language highlighting
addshore Sep 17, 2025
b5a79ef
markdown pluginx, mainly for images, css, spelling etc
addshore Sep 17, 2025
c50c7cf
no longer import defineProps
addshore Sep 17, 2025
1da966e
Include toit code examples from the library
addshore Sep 17, 2025
55b4cc7
Link from toit startg to example
addshore Sep 17, 2025
f3890c0
Dont collapse protocol and messages menus
addshore Sep 17, 2025
98a37a7
Include toit tmLanguage.json from submodule
addshore Sep 18, 2025
e0670d8
Github actions need submodules
addshore Sep 18, 2025
2dbabae
Update protocol changes
addshore Sep 18, 2025
fa0144f
Plugin for markdownit YAML inclusion...
addshore Sep 18, 2025
a8092a3
PayloadTable from pre loaded data
addshore Sep 18, 2025
54a650f
GenerateConsts with pre loaded data
addshore Sep 18, 2025
821721a
Use yaml-data throughout for protocol YAML
addshore Sep 19, 2025
73b2a7f
ProtocolBytes dont load yaml, get provided it
addshore Sep 19, 2025
36d1082
Build fixes
addshore Sep 19, 2025
58226db
minor fixes to rh2 spec
chris-lightbug Oct 1, 2025
15eeddf
Fix weight of rh2
chris-lightbug Oct 1, 2025
75795b5
reorder spec sections
addshore Oct 1, 2025
f836f8e
Remove YAML download button for specs
addshore Oct 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/deploy-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0

- uses: actions/setup-node@v3
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0

- uses: actions/setup-node@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "ext/toit-lightbug"]
path = ext/toit-lightbug
url = https://github.com/lightbug-io/toit-lightbug.git
[submodule "ext/toit-ide-tools"]
path = ext/toit-ide-tools
url = https://github.com/toitware/ide-tools
243 changes: 187 additions & 56 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import { loadSpec } from '../swagger/load';
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs';
import { pagefindPlugin } from 'vitepress-plugin-pagefind';
import { withMermaid } from "vitepress-plugin-mermaid";
import { imgSize } from "@mdit/plugin-img-size";
import { figure } from "@mdit/plugin-figure";
import { attrs } from "@mdit/plugin-attrs";
import { align } from "@mdit/plugin-align";
import { include } from "@mdit/plugin-include";
import { withSidebar, generateSidebar } from 'vitepress-sidebar';
import yamlEmbed from '../utils/markdownit-yaml-plugin.js';


// Load protocol messages from YAML file
Expand Down Expand Up @@ -46,21 +53,86 @@ const protocolMenuItems = Object.keys(protocolGroups)
// Ability to generate other collections of side bar entries
const sidebarItemsFromDir = (dir) => {
const files = fs.readdirSync(dir)
return files
.filter(file => file !== 'index.md')
.map(file => {
const name = file.replace('.md', '')
const displayName = name.charAt(0).toUpperCase() + name.slice(1).replace(/-/g, ' ');
return {
text: displayName,
link: `${dir}/${name}`
.filter(file => file !== 'index.md' && file.endsWith('.md'))

const items = files.map(file => {
const fullPath = path.resolve(dir, file);
let order = 100;
try {
const content = fs.readFileSync(fullPath, 'utf8');
// simple frontmatter parse: look for leading --- yaml --- block
const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
if (fmMatch) {
const fm = yaml.load(fmMatch[1]);
if (fm && typeof fm.order === 'number') {
order = fm.order;
}
}
})
} catch (e) {
// ignore and use default order
}

const name = file.replace('.md', '')
const displayName = name.charAt(0).toUpperCase() + name.slice(1).replace(/-/g, ' ');
return {
text: displayName,
link: `${dir}/${name}`,
order,
}
})

// sort by order, then by text
items.sort((a, b) => {
if (a.order !== b.order) return a.order - b.order;
return a.text.localeCompare(b.text);
});

// remove the temporary order field before returning
return items.map(({ order, ...rest }) => rest)
}

const sidebarSpec1 = useSidebar({ spec: loadSpec(1) });
const sidebarSpec2 = useSidebar({ spec: loadSpec(2) });

// Generate Admin Actions sidebar automatically using vitepress-sidebar
const generateAdminDevicesSidebar = () => {
// Helper function to fix links recursively
const fixLinks = (items, prefix = '/apps/admin/devices') => {
return items.map(item => {
const newItem = { ...item };

// Fix the link if it exists and doesn't already start with the prefix
if (newItem.link && !newItem.link.startsWith(prefix)) {
newItem.link = prefix + (newItem.link.startsWith('/') ? '' : '/') + newItem.link;
}

// Recursively fix nested items
if (newItem.items) {
newItem.items = fixLinks(newItem.items, prefix);
}

return newItem;
});
};

// Use vitepress-sidebar to auto-generate the entire devices section
const devicesSidebar = generateSidebar({
documentRootPath: '/',
scanStartPath: 'apps/admin/devices',
hyphenToSpace: true,
capitalizeFirst: true,
useTitleFromFrontmatter: true,
sortMenusByFrontmatterOrder: true,
frontmatterOrderDefaultValue: 100,
includeRootIndexFile: false,
includeFolderIndexFile: false,
useFolderLinkFromIndexFile: true,
});

const fixedSidebar = Array.isArray(devicesSidebar) ? fixLinks(devicesSidebar) : devicesSidebar;
return fixedSidebar as any;
};

// Function to make a sidebar group be collapsed
function collapse(group) {
group.collapsed = true;
Expand Down Expand Up @@ -94,6 +166,9 @@ export default withMermaid(defineConfig({
description: "home for everything Lightbug",
lang: 'en-GB',
cleanUrls: true,
sitemap: {
hostname: process.env.DEPLOYMENT_NAME === 'Production' ? 'https://docs.lightbug.io' : 'https://docs-next.lightbug.io'
},
rewrites: {
'/onprem/' : '/silos/',
},
Expand All @@ -113,7 +188,35 @@ export default withMermaid(defineConfig({
markdown: {
config: (md) => {
md.use(tabsMarkdownPlugin)
md.use(imgSize)
md.use(figure)
md.use(attrs)
md.use(align)
// Embed YAML values from files during markdown parsing to avoid Vue
// interpolation errors for `{{yaml:...}}` tokens.
md.use(yamlEmbed, { baseDir: path.resolve(__dirname, '..', 'public', 'files') })
md.use(include,{
currentPath: () => {
return path.resolve(__dirname, '..', 'index.md');
},
})
},
languages: (() => {
try {
const toitGrammar = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../ext/toit-ide-tools/vscode/syntaxes/toit.tmLanguage.json'), 'utf8'));

const toitLang = {
...toitGrammar,
id: 'toit',
aliases: ['toit']
};

return [toitLang];
} catch (error) {
console.error('Error loading Toit grammar:', error);
return [];
}
})(),
container: {
tipLabel: '⚡ Tip',
warningLabel: '⚠️ Warning',
Expand All @@ -138,6 +241,23 @@ export default withMermaid(defineConfig({
gtag('js', new Date());
gtag('config', '${process.env.PUBLIC_GOOGLE_ANALYTICS}');`
]
,
[
'link',
{ rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png' }
],
[
'link',
{ rel: 'icon', type: 'image/png', sizes: '32x32', href: '/favicon-32x32.png' }
],
[
'link',
{ rel: 'icon', type: 'image/png', sizes: '16x16', href: '/favicon-16x16.png' }
],
[
'link',
{ rel: 'manifest', href: '/site.webmanifest' }
],
],
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
Expand Down Expand Up @@ -190,8 +310,17 @@ export default withMermaid(defineConfig({
{
text: 'General',
items: [
{
text: 'Positioning',
link: '/terminology/positioning/',
items: [
{ text: 'GNSS', link: '/terminology/positioning/gnss' },
{ text: 'RTK', link: '/terminology/positioning/rtk' },
{ text: 'WiFi', link: '/terminology/positioning/wifi' },
{ text: 'Cellular', link: '/terminology/positioning/cellular' },
]
},
{ text: 'IoT', link: '/terminology/iot' },
{ text: 'Positioning', link: '/terminology/positioning' },
{ text: 'Observability', link: '/terminology/observability' },
]
},
Expand Down Expand Up @@ -241,10 +370,23 @@ export default withMermaid(defineConfig({
text: 'Enviro',
link: '/devices/enviro/',
},
]
},
{
text: 'RTK',
items: [
{
text: 'RTK',
link: '/devices/rtk/',
text: 'Handheld',
link: '/devices/rtk/handheld/',
collapsed: true,
items: [
{ text: 'External', link: '/devices/rtk/handheld/external' },
{ text: 'Screen', link: '/devices/rtk/handheld/screen' },
{ text: 'ESP32', link: '/devices/rtk/handheld/esp32' },
{ text: 'Accessories', link: '/devices/rtk/handheld/accessories' },
]
},
{ text: 'Vehicle', link: '/devices/rtk/vehicle' },
]
},
{
Expand All @@ -257,7 +399,7 @@ export default withMermaid(defineConfig({
},
{
text: 'Lineage',
link: '/devices/history',
link: '/devices/history/',
collapsed: true,
items: [
{ text: 'VT2', link: '/devices/history/VT2' },
Expand Down Expand Up @@ -288,34 +430,48 @@ export default withMermaid(defineConfig({
link: '/devices/api/glossary',
},
{
text: 'Structure',
collapsed: true,
link: '/devices/api/structure',
text: 'Toit',
link: '/devices/api/sdks/toit/',
items: [
{ text: 'Getting Started', link: '/devices/api/sdks/toit/getting-started' },
{
text: 'Examples',
link: '/devices/api/sdks/toit/examples/',
items: sidebarItemsFromDir('devices/api/sdks/toit/examples')
},
],
},
{
text: 'Messages',
link: '/devices/api/messages',
items: protocolMenuItems,
},
{
text: 'Protocol',
link: '/devices/api/protocol/',
items: [
{
text: 'Prefix',
link: '/devices/api/structure#prefix',
link: '/devices/api/protocol/prefix',
},
{
text: 'Stop',
link: '/devices/api/protocol/stop',
},
{
text: 'Structure',
link: '/devices/api/protocol/structure',
},
{
text: 'Message',
link: '/devices/api/structure#message',
text: 'Headers',
link: '/devices/api/protocol/headers',
},
{
text: 'Examples',
link: '/devices/api/structure#examples',
link: '/devices/api/protocol/examples',
},
]
},
{
text: 'Headers',
link: '/devices/api/headers',
},
{
text: 'Messages',
collapsed: true,
link: '/devices/api/messages',
items: protocolMenuItems,
},
{
text: 'Tools',
collapsed: true,
Expand All @@ -334,26 +490,6 @@ export default withMermaid(defineConfig({
},
]
},
{
text: 'SDKs',
collapsed: true,
items: [
{
text: 'Toit',
link: '/devices/api/sdks/toit/',
items: [
{ text: 'Getting Started', link: '/devices/api/sdks/toit/getting-started' },
{
text: 'Examples',
link: '/devices/api/sdks/toit/examples/',
items: [
{ text: 'EInk Hello World', link: '/devices/api/sdks/toit/examples/eink' },
]
},
],
},
]
},
]
},
],
Expand Down Expand Up @@ -630,12 +766,7 @@ export default withMermaid(defineConfig({
]
},
{ text: 'Devices', link: '/apps/admin/devices', // No ending /, as the sub items are not sub pages
items: [
{ text: 'Actions', link: '/apps/admin/devices#actions' },
{ text: 'Metrics', link: '/apps/admin/devices#metric-summary' },
{ text: 'Timeline', link: '/apps/admin/devices#timeline' },
]

items: generateAdminDevicesSidebar()
},
{ text: 'Configs', link: '/apps/admin/configs' },
{ text: 'Users', link: '/apps/admin/users' },
Expand Down
2 changes: 2 additions & 0 deletions .vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const redirects = Object.entries({
'/devices/api/generate': '/devices/api/tools/generate',
'/apps/admin/creating-account': '/apps/admin/authentication#creating-an-account',
'/apps/admin/permissions': '/apps/admin/authentication#permissions',
'/devices/api/structure': '/devices/api/protocol',
'/devices/api/headers': '/devices/api/protocol/headers',
})

watch(
Expand Down
Loading