### Start LeafWiki Frontend Development Server Source: https://github.com/perber/leafwiki/blob/main/CONTRIBUTING.md Navigate to the UI directory, install dependencies, and start the frontend development server. ```bash cd ui/leafwiki-ui npm install npm run dev ``` -------------------------------- ### Enable and Start Nginx Source: https://github.com/perber/leafwiki/blob/main/docs/install/nginx.md Configure Nginx to start automatically on boot and then start the service. ```bash sudo systemctl enable nginx sudo systemctl start nginx ``` -------------------------------- ### Install LeafWiki Source: https://github.com/perber/leafwiki/blob/main/docs/install/nginx.md Download, make executable, and run the LeafWiki installation script. Ensure you have the correct architecture and specify the host and port. ```bash curl -sL https://raw.githubusercontent.com/perber/leafwiki/main/install.sh -o install.sh chmod +x ./install.sh sudo ./install.sh --arch arm64 --port 8080 --host 127.0.0.1 ``` -------------------------------- ### Install Nginx Source: https://github.com/perber/leafwiki/blob/main/docs/install/nginx.md Update package lists and install the Nginx web server on Ubuntu. ```bash sudo apt update sudo apt install nginx -y ``` -------------------------------- ### Install LeafWiki using Linux Script Source: https://github.com/perber/leafwiki/blob/main/README.md Installs LeafWiki as a system service using a provided script. Tested on Ubuntu, Debian, and Raspbian. This is the recommended method for Linux installations. ```bash sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/perber/leafwiki/main/install.sh)" ``` -------------------------------- ### Install LeafWiki with Docker Compose Source: https://github.com/perber/leafwiki/blob/main/README.md This command demonstrates how to install and run LeafWiki using Docker. It maps the host's ~/leafwiki-data directory to the container's /app/data for persistent storage, exposes port 8080, and configures JWT secret, admin password, and insecure mode. ```bash docker run -p 8080:8080 \ -v ~/leafwiki-data:/app/data \ ghcr.io/perber/leafwiki:latest \ --jwt-secret=yoursecret \ --admin-password=yourpassword \ --allow-insecure=true ``` -------------------------------- ### Start LeafWiki Backend Development Server Source: https://github.com/perber/leafwiki/blob/main/CONTRIBUTING.md In a separate terminal, navigate to the backend command directory and run the Go application with development flags. ```bash cd cmd/leafwiki go run main.go --jwt-secret=dev --admin-password=dev --public-access=true --allow-insecure=true ``` -------------------------------- ### Install Leafwiki on Raspberry Pi Source: https://github.com/perber/leafwiki/blob/main/docs/install/raspberry.md This command downloads, makes executable, and runs the Leafwiki installation script on a Raspberry Pi with an ARM64 architecture. Ensure you have curl and sudo privileges. ```bash curl -sL https://raw.githubusercontent.com/perber/leafwiki/main/install.sh -o install.sh && chmod +x ./install.sh && sudo ./install.sh --arch arm64 ``` -------------------------------- ### Non-interactive LeafWiki Installation Source: https://github.com/perber/leafwiki/blob/main/README.md Installs LeafWiki in non-interactive mode by first copying and editing the environment file. Ensure the `.env` file is configured before running the installation. ```bash cp .env.example .env # Edit .env with your configuration sudo ./install.sh --non-interactive --env-file "./.env" ``` -------------------------------- ### Reserved Slug Handling Example Source: https://github.com/perber/leafwiki/blob/main/internal/importer/fixtures/link-assets-package/README.md Demonstrates handling of reserved slugs, specifically referencing `Reference/API.md`. ```markdown Reference/API.md ``` -------------------------------- ### Install Certbot for Nginx Source: https://github.com/perber/leafwiki/blob/main/docs/install/nginx.md Install Certbot along with the Nginx plugin to automate SSL certificate management. ```bash sudo apt update sudo apt install certbot python3-certbot-nginx -y ``` -------------------------------- ### Conventional Commits Examples Source: https://github.com/perber/leafwiki/blob/main/CONTRIBUTING.md Examples of commit messages formatted according to the Conventional Commits specification. ```git feat(editor): add keyboard shortcut for headings ``` ```git fix(search): handle empty query correctly ``` ```git docs(readme): clarify installation instructions ``` ```git refactor(api): simplify page loading logic ``` -------------------------------- ### Markdown Table Example Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Create tables using pipes and hyphens. This is useful for presenting structured data. ```markdown | Option | Description | | ------ | ----------- | | data | path to data files to supply the data that will be passed into templates. | | engine | engine to be used for processing templates. Handlebars is the default. | | ext | extension to be used for dest files. | ``` -------------------------------- ### Update LeafWiki using Linux Script Source: https://github.com/perber/leafwiki/blob/main/README.md Updates an existing LeafWiki installation that was initially set up with the install script. This method is not compatible with Docker or binary installations. ```bash sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/perber/leafwiki/main/update.sh)" ``` -------------------------------- ### Inline Code Example Source: https://github.com/perber/leafwiki/blob/main/internal/importer/fixtures/link-assets-package/README.md Inline code within the markdown content should be preserved exactly as it appears. ```markdown inline code that must stay unchanged ``` -------------------------------- ### Nginx Reverse Proxy Configuration Source: https://github.com/perber/leafwiki/blob/main/docs/install/nginx.md Create a new Nginx site configuration file to proxy requests to the LeafWiki application. This setup directs traffic from a domain to the local LeafWiki instance. ```nginx server { listen 80; listen [::]:80; server_name demo.leafwiki.com; location / { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } ``` -------------------------------- ### Fenced Code Block Example Source: https://github.com/perber/leafwiki/blob/main/internal/importer/fixtures/link-assets-package/README.md Fenced code blocks in the markdown content are intended to be preserved without modification. ```markdown fenced code blocks that must stay unchanged ``` -------------------------------- ### Enable Site and Reload Nginx Source: https://github.com/perber/leafwiki/blob/main/docs/install/nginx.md Create a symbolic link to enable the new Nginx site configuration, test the configuration syntax, and then reload Nginx to apply changes. ```bash sudo ln -s /etc/nginx/sites-available/demo.leafwiki.com.conf /etc/nginx/sites-enabled/demo.leafwiki.com.conf sudo nginx -t sudo systemctl reload nginx ``` -------------------------------- ### Run LeafWiki Backend Development Server Source: https://github.com/perber/leafwiki/blob/main/README.md Compiles and runs the LeafWiki backend server using Go. Requires setting JWT secret, allowing insecure connections, and providing an admin password. ```bash cd cmd/leafwiki go run main.go --jwt-secret=yoursecret --allow-insecure=true --admin-password=yourpassword ``` -------------------------------- ### Run LeafWiki Binary Source: https://github.com/perber/leafwiki/blob/main/README.md Executes the LeafWiki binary directly. Use `--allow-insecure=true` for plain HTTP. The server binds to `127.0.0.1:8080` by default. ```bash chmod +x leafwiki ./leafwiki --jwt-secret=yoursecret --admin-password=yourpassword --allow-insecure=true ``` -------------------------------- ### Expose LeafWiki Binary on Network Source: https://github.com/perber/leafwiki/blob/main/README.md Runs the LeafWiki binary and exposes it on the network by binding to `0.0.0.0`. Requires setting JWT secret, admin password, and allowing insecure connections for HTTP. ```bash ./leafwiki --jwt-secret=yoursecret --admin-password=yourpassword --host=0.0.0.0 --allow-insecure=true ``` -------------------------------- ### Configure Custom Stylesheet Source: https://github.com/perber/leafwiki/blob/main/README.md Specify a custom CSS file to be served at the root or under a base path. The file must exist within the data directory. ```bash ./leafwiki \ --data-dir=./data \ --custom-stylesheet=custom.css \ --jwt-secret=yoursecret \ --admin-password=yourpassword ``` -------------------------------- ### Format UI Code Source: https://github.com/perber/leafwiki/blob/main/CONTRIBUTING.md Execute the npm run format command in the ui/leafwiki-ui directory to format the frontend code. ```bash npm run format ``` -------------------------------- ### Run LeafWiki with Docker Source: https://github.com/perber/leafwiki/blob/main/README.md This command runs LeafWiki using Docker, mapping the host's ~/leafwiki-data directory to the container's /app/data for persistent storage. It exposes port 8080 and sets a JWT secret, admin password, and allows insecure connections. ```bash docker run -p 8080:8080 -v ~/leafwiki-data:/app/data \ ghcr.io/perber/leafwiki:latest \ --jwt-secret=yoursecret --admin-password=yourpassword --allow-insecure=true ``` -------------------------------- ### Configure Reverse-Proxy Authentication Source: https://github.com/perber/leafwiki/blob/main/README.md Enable authentication via HTTP headers from a trusted reverse proxy. Configure the header name, trusted proxy IPs, and a logout URL. ```bash ./leafwiki \ --jwt-secret=yoursecret \ --admin-password=yourpassword \ --enable-http-remote-user=true \ --http-remote-user-header-name=X-Forwarded-User \ --trusted-proxy-ips=127.0.0.1,172.18.0.0/16 \ --http-remote-user-logout-url=https://auth.example.com/logout ``` -------------------------------- ### Custom Container Block Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Use ::: container_name ... ::: syntax to create custom content blocks. These can be styled with CSS. ```markdown ::: warning *here be dragons* ::: ``` -------------------------------- ### Run LeafWiki with Docker (Non-root) Source: https://github.com/perber/leafwiki/blob/main/README.md This Docker command runs LeafWiki as a non-root user (UID/GID 1000:1000), which is useful for security or specific Docker configurations. It maps the data directory and sets essential parameters like JWT secret and admin password. ```bash docker run -p 8080:8080 \ -u 1000:1000 \ -v ~/leafwiki-data:/app/data \ ghcr.io/perber/leafwiki:latest \ --jwt-secret=yoursecret \ --admin-password=yourpassword \ --allow-insecure=true ``` -------------------------------- ### Clone LeafWiki Repository Source: https://github.com/perber/leafwiki/blob/main/CONTRIBUTING.md Clone the LeafWiki repository to your local machine and navigate into the project directory. ```bash git clone https://github.com/perber/leafwiki.git cd leafwiki ``` -------------------------------- ### Internal Wiki Link with Alias Source: https://github.com/perber/leafwiki/blob/main/internal/importer/fixtures/obsidian-wikilinks-package/Home.md Creates a link to another note but displays it with a custom alias. ```markdown [[Daily/Meeting Notes|Meeting Alias]] ``` -------------------------------- ### Definition List Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Create definition lists using a term followed by a colon and its definition. Indentation is used for multi-line definitions. ```markdown Term 1 : Definition 1 with lazy continuation. Term 2 with *inline markup* : Definition 2 { some code, part of Definition 2 } Third paragraph of definition 2. ``` -------------------------------- ### Compact Definition List Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md A more compact syntax for definition lists using a tilde `~` for definitions. This reduces vertical spacing. ```markdown _Compact style:_ Term 1 ~ Definition 1 Term 2 ~ Definition 2a ~ Definition 2b ``` -------------------------------- ### Obtain SSL Certificate with Certbot Source: https://github.com/perber/leafwiki/blob/main/docs/install/nginx.md Use Certbot to obtain an SSL certificate for your domain and automatically configure Nginx to use it for HTTPS. Follow the interactive prompts for email and terms of service. ```bash sudo certbot --nginx -d demo.leafwiki.com ``` -------------------------------- ### Superscript and Subscript Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Use caret `^` for superscript and tilde `~` for subscript. These are supported via specific markdown-it plugins. ```markdown - 19^th^ - H~2~O ``` -------------------------------- ### Docker Compose Configuration for LeafWiki Source: https://github.com/perber/leafwiki/blob/main/README.md Use this Docker Compose file to run LeafWiki in a containerized environment. Ensure you set LEAFWIKI_JWT_SECRET and LEAFWIKI_ADMIN_PASSWORD. The `allow-insecure` flag is required for plain HTTP. ```yaml services: leafwiki: image: ghcr.io/perber/leafwiki:latest container_name: leafwiki user: 1000:1000 ports: - "8080:8080" environment: - LEAFWIKI_JWT_SECRET=yourSecret - LEAFWIKI_ADMIN_PASSWORD=yourPassword - LEAFWIKI_ALLOW_INSECURE=true # Required for plain HTTP. Omit for HTTPS (ensure `X-Forwarded-Proto: https` is forwarded). volumes: - ${HOME}/leafwiki-data:/app/data restart: unless-stopped ``` -------------------------------- ### Final Nginx Configuration with HTTPS Source: https://github.com/perber/leafwiki/blob/main/docs/install/nginx.md This is the Nginx configuration after Certbot has been run, including settings for HTTPS, SSL certificate paths, and automatic redirection from HTTP to HTTPS. ```nginx server { server_name demo.leafwiki.com; client_max_body_size 50M; location / { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } listen [::]:443 ssl ipv6only=on; # managed by Certbot listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/demo.leafwiki.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/demo.leafwiki.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = demo.leafwiki.com) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; listen [::]:80; server_name demo.leafwiki.com; return 404; # managed by Certbot } ``` -------------------------------- ### Test Certbot Auto-Renewal Source: https://github.com/perber/leafwiki/blob/main/docs/install/nginx.md Simulate the SSL certificate renewal process to ensure Certbot's automatic renewal mechanism is functioning correctly. ```bash sudo certbot renew --dry-run ``` -------------------------------- ### Fenced Code Block Links Source: https://github.com/perber/leafwiki/blob/main/internal/importer/fixtures/link-assets-package/Guides/Setup.md Demonstrates how Markdown links, Wiki links, and asset links are rendered within a fenced code block. ```markdown [Fenced](../Reference/Endpoints.md) [[Reference/Endpoints|Fence Alias]] ![[./images/logo.png]] ``` -------------------------------- ### Code Block with Syntax Highlighting Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Specify the language after the opening triple backticks to enable syntax highlighting. This improves code readability. ```javascript ``` js var foo = function (bar) { return bar++; }; console.log(foo(5)); ``` ``` -------------------------------- ### Disable Authentication for Local Development Source: https://github.com/perber/leafwiki/blob/main/README.md Disable all authentication mechanisms for local development or isolated environments. Ensure this is only used in trusted networks. ```bash ./leafwiki --disable-auth --host=127.0.0.1 ``` -------------------------------- ### Internal Wiki Link Source: https://github.com/perber/leafwiki/blob/main/internal/importer/fixtures/obsidian-wikilinks-package/Home.md Represents a direct link to another note within the vault. ```markdown [[Project Plan]] ``` -------------------------------- ### Image Embed Source: https://github.com/perber/leafwiki/blob/main/internal/importer/fixtures/obsidian-wikilinks-package/Home.md Embeds an image file directly into the note. The exclamation mark indicates an embed. ```markdown ![[Attachments/diagram.png]] ``` -------------------------------- ### HTML Abbreviation Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Define abbreviations using `*[]:`. This allows for expanding short terms into their full form, useful for acronyms. ```markdown *[HTML]: Hyper Text Markup Language ``` -------------------------------- ### Internal Wiki Link in Code Block Source: https://github.com/perber/leafwiki/blob/main/internal/importer/fixtures/obsidian-wikilinks-package/Home.md Shows an internal wiki link within a markdown code block. ```markdown [[Daily/Meeting Notes]] ``` -------------------------------- ### Marked Text Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Use double equals signs `==` to highlight text, similar to a marker. Supported by the `markdown-it-mark` plugin. ```markdown ==Marked text== ``` -------------------------------- ### Indented Code Block Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Use 4 spaces or 1 tab to indent code blocks. This is useful for displaying code snippets without markdown interpretation. ```markdown // Some comments line 1 of code line 2 of code line 3 of code ``` -------------------------------- ### Inline Footnote Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Define footnotes directly inline using `^[Text of inline footnote]`. This is a concise way to add brief annotations. ```markdown Inline footnote^[Text of inline footnote] definition. ``` -------------------------------- ### Footnote Definition Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Define footnotes using a caret and bracket `[^label]`. Multiple paragraphs and markup are supported within the footnote body. ```markdown [^first]: Footnote **can have markup** and multiple paragraphs. [^second]: Footnote text. ``` -------------------------------- ### Reset LeafWiki Admin Password Source: https://github.com/perber/leafwiki/blob/main/README.md Resets the admin password for LeafWiki by executing the `reset-admin-password` command on the binary. ```bash ./leafwiki reset-admin-password ``` -------------------------------- ### Emoji Shortcodes Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Use colon-enclosed shortcodes for emojis. This allows for quick insertion of emoticons and symbols. ```markdown > Classic markup: :wink: :cry: :laughing: :yum: > > Shortcuts (emoticons): :-) :-( 8-) ;) ``` -------------------------------- ### Fenced Code Block Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Enclose code in triple backticks for a distinct code block. This method is generally preferred for clarity. ```markdown ``` Sample text here... ``` ``` -------------------------------- ### Inserted Text Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Use double plus signs `++` to denote inserted text, typically rendered as underlined. Supported by the `markdown-it-ins` plugin. ```markdown ++Inserted text++ ``` -------------------------------- ### Right-Aligned Table Columns Source: https://github.com/perber/leafwiki/blob/main/e2e/assets/markdown-it-sample.md Align column content by adding colons to the separator line. This can improve table readability for specific data types. ```markdown | Option | Description | | ------:| -----------:| | data | path to data files to supply the data that will be passed into templates. | | engine | engine to be used for processing templates. Handlebars is the default. | | ext | extension to be used for dest files. | ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.