Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build

on:
# Run the build for pushes and pull requests targeting main
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14]

steps:
# Checkout doc repo and its dependencies
- name: Checkout
uses: actions/checkout@v2
# Setup Node
- name: Setup (Node.js ${{ matrix.node-version }})
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# Install and build
- name: Install
run: npm ci
- name: Build
run: npm run build
# Deploy, limited to the main branch
- name: Deploy
if: success() && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./docs/.vuepress/dist
github_token: ${{ secrets.GITHUB_TOKEN }}
cname: lightningdevkit.org
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
# Run linkcheck, propagate linkcheck failure through grep pipe
- name: Linkcheck
run: set -o pipefail; npm run linkcheck 2>/dev/null | grep "Getting links from\|BROKEN"
continue-on-error: true
82 changes: 65 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,81 @@
# Website
# Lightning Dev Kit Documentation

This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
[![Build Status](https://github.com/lightningdevkit/lightningdevkit.org/workflows/Build/badge.svg)](https://github.com/lightningdevkit/lightningdevkit.org/actions?query=workflow%3A%22Build%22)

## Installation
### Build the Documentation Locally

```console
yarn install
In order to build the website locally, you'll need [Node.js](https://nodejs.org/) >= 14.16 (or basically the latest LTS version).

The setup is straight forward:

```bash
# Install dependencies
npm install

# Serve locally (by default on port 8080)
npm start
```

## Local Development
### Text Highlights

There are [three types of text highlights](https://vuepress.vuejs.org/guide/markdown.html#custom-containers) that can be used to display different colored boxes.

```console
yarn start
A green box displaying a friendly tip:

```md
:::tip
foo
:::
```

This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
A yellow box with a cautious warning:

```md
:::warning
foo
:::
```

## Build
A red box with a clear danger, you can also add a title `foo` to any container:

```console
yarn build
```md
:::danger foo
bar
:::
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
### SEO improvements

We are using the [Vuepress SEO plugin](https://www.npmjs.com/package/vuepress-plugin-seo) to add relevant meta tags to the site and individual pages.

## Deployment
To improve the meta attributes of a specific page, you can add them as YAML frontmatter like this: (see the WooCommerce page for an example)

```console
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
```text
---
description: How to integrate LDK
tags:
- WooCommerce
- WordPress
- Plugin
- eCommerce
---
# LDK integration

This document explains how to **integrate LDK into your stack**.
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
### Embedding YouTube videos

To add a YouTube video with a preview, you can so so by linking to it like this:

```md
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/mqdefault.jpg)](https://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)
```

Note that the link item need to be a preview image (either from YouTube or a custom one) to result in an embedded video.

### Check for broken links

The GitHub Actions pipeline checks for broken links after deploying the production site.
You can also run the link check locally using `npm run linkcheck:local`.
The dev server needs to be running alongside for this to work.
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

119 changes: 119 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
const { resolve } = require('path')
const implicitFigures = require('markdown-it-implicit-figures')
const slugify = require('./slugify')
const preprocessMarkdown = resolve(__dirname, 'preprocessMarkdown')

const title = 'Lightning Dev Kit Documentation'
const baseUrl = 'https://lightningdevkit.org'
const themeColor = '#ffffff'
const pageSuffix = '/'
const info = { name: title }
const extractDescription = text => {
if (!text) return
const paragraph = text.match(/^[A-Za-z].*(?:\n[A-Za-z].*)*/m)
return paragraph ? paragraph.toString().replace(/[\*\_\(\)\[\]]/g, '') : null
}

module.exports = {
title,
description: 'LDK is a flexible lightning implementation with supporting batteries (or modules).',
head: [
['link', { rel: 'preload', href: '/fonts/manrope-v4-latin-regular.woff2', as: 'font', crossorigin: true }],
['link', { rel: 'preload', href: '/fonts/manrope-v4-latin-600.woff2', as: 'font', crossorigin: true }],
['link', { rel: 'preload', href: '/fonts/ibm-plex-mono-v6-latin-regular.woff2', as: 'font', crossorigin: true }],
['link', { rel: 'apple-touch-icon', sizes: '180x180', href: '/img/favicon/apple-touch-icon.png' }],
['link', { rel: 'manifest', href: '/site.webmanifest' }],
['link', { name: 'msapplication-config', content: '/browserconfig.xml' }],
['link', { name: 'msapplication-TileColor', content: themeColor }],
['link', { name: 'theme-colorr', content: themeColor }]
],
chainWebpack (config) {
config.module
.rule('md')
.test(/\.md$/)
.use(preprocessMarkdown)
.loader(preprocessMarkdown)
.end()
},
plugins: [
['seo', {
siteTitle: (_, $site) => $site.title,
title: $page => $page.title,
description: $page => $page.frontmatter.description || extractDescription($page._strippedContent),
author: (_, $site) => info,
tags: $page => ($page.frontmatter.tags || ['Bitcoin', 'Lightning Network', 'LDK']),
twitterCard: _ => 'summary',
type: $page => 'article',
url: (_, $site, path) => `${baseUrl}${path.replace('.html', pageSuffix)}`
}],
['clean-urls', {
normalSuffix: pageSuffix,
indexSuffix: pageSuffix,
notFoundPath: '/404.html',
}],
['code-copy', {
color: '#8F979E',
backgroundTransition: false,
staticIcon: true
}],
['sitemap', {
hostname: baseUrl,
exclude: ['/404.html']
}],
['tabs'],
['@vuepress/medium-zoom']
],
markdown: {
extendMarkdown (md) {
md.use(implicitFigures)
},
pageSuffix,
slugify
},
themeConfig: {
domain: baseUrl,
logo: '/img/logo.svg',
displayAllHeaders: false,
repo: 'lightningdevkit/lightningdevkit.org',
docsDir: 'docs',
editLinks: true,
sidebarDepth: 2,
nav: [
{
text: 'Docs',
link: '/overview/'
},
{
text: 'Slack',
link: 'https://lightningdevkit.slack.com/',
rel: 'noopener noreferrer github'
},
{
text: 'GitHub',
link: 'https://github.com/lightningdevkit',
rel: 'noopener noreferrer github'
}
],
sidebar: [
{
title: 'Lightning Development Kit',
collapsable: false,
children: [
'/overview',
'/use_cases'
]
},
{
title: 'Guides',
collapsable: false,
children: [
'/build_node',
'/build_node_rust',
'/using_ldk',
'/key_mgmt',
'/blockdata'
],
}
]
}
}
63 changes: 63 additions & 0 deletions docs/.vuepress/enhanceApp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const { COLOR_MODES, STORE_ATTR, setColorMode } = require('./themeSwitch')

// https://v1.vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements
const openVideo = embedEl => {
const lazyAttr = 'data-src'
const iframe = embedEl.querySelector(`iframe[${lazyAttr}]`)
if (iframe) {
const src = iframe.getAttribute(lazyAttr)
iframe.setAttribute('src', src)
}
}

const isEnter = e => e.code === 'Enter' || (e.keyCode || e.which) === 13

const handleClick = e => {
const isSearchInput = e.target.matches('#algolia-search-input') && isEnter(e)

// blur search field on select
if (e.target.matches('.ds-dropdown-menu *') || isSearchInput) {
document.getElementById('algolia-search-input').blur()
}

// youtube previews
if (e.target.matches('.ytEmbed')) {
e.preventDefault()
openVideo(e.target)
}
}

// Theme Switch
if (typeof process === 'undefined' || process.env.VUE_ENV !== 'server') {
const systemColorMode = window.matchMedia('(prefers-color-scheme: dark)').matches ? COLOR_MODES[1] : COLOR_MODES[0]
const userColorMode = window.localStorage.getItem(STORE_ATTR)
const initialColorMode = COLOR_MODES.includes(userColorMode) ? userColorMode : systemColorMode

setColorMode(initialColorMode)
}

export default ({ router }) => {
if (typeof process === 'undefined' || process.env.VUE_ENV !== 'server') {
router.onReady(() => {
const { app } = router

// initial page rendering
app.$once('hook:mounted', () => {
// temporary fix for https://github.com/vuejs/vuepress/issues/2428
setTimeout(() => {
const { hash } = document.location
if (hash.length > 1) {
const id = hash.substring(1)
const element = document.getElementById(id)
if (element) element.scrollIntoView()
}
}, 500)
})

document.addEventListener('click', handleClick)
document.addEventListener('keyup', e => {
if (isEnter(e)) handleClick(e)
})
})
}
}
33 changes: 33 additions & 0 deletions docs/.vuepress/preprocessMarkdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const replaceYouTubeLinks = source =>
source.replace(/\[(!.*)\]\((.*(youtube\.com\/watch|youtu\.be).*?)(?:\s"(.*?)")?\)/gi, (all, preview, url, text) => {
const [, query] = url.match(/\?(.*)/) || url.match(/.*youtu\.be\/(.*)/)
const params = query.split('&').reduce((res, param) => {
let [key, val] = param.split('=')
if (param === key) {
key = 'v'
val = param
}
return Object.assign(res, { [key]: val })
}, {})
const { v, t } = params
const path = t ? `${v}?start=${t}` : `${v}?`

return `
<a href="${url}" class="ytEmbed" data-id="${v}" style="background-image:url(https://img.youtube.com/vi/${v}/hqdefault.jpg);">
<iframe
title="YouTube"
data-src="https://www.youtube-nocookie.com/embed/${path}&autoplay=1&autohide=1&modestbranding=1&color=white&rel=0"
frameborder="0"
allow="autoplay;encrypted-media;picture-in-picture"
allowfullscreen
></iframe>
</a>`
})

// https://webpack.js.org/api/loaders/
module.exports = function (source) {
const { resourcePath } = this
let processed = source
processed = replaceYouTubeLinks(processed)
return processed
}
9 changes: 9 additions & 0 deletions docs/.vuepress/public/browserconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/img/favicon/mstile-150x150.png"/>
<TileColor>#ffffff</TileColor>
</tile>
</msapplication>
</browserconfig>
Binary file added docs/.vuepress/public/favicon.ico
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/.vuepress/public/img/illustration/01.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/.vuepress/public/img/illustration/02.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/.vuepress/public/img/illustration/03.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/.vuepress/public/img/illustration/04.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading