diff --git a/docs/getting-started/basic-app.cmake b/docs/getting-started/basic-app.cmake
new file mode 100644
index 0000000..527df76
--- /dev/null
+++ b/docs/getting-started/basic-app.cmake
@@ -0,0 +1,26 @@
+cmake_minimum_required(VERSION 3.21)
+project(your_awesome_app LANGUAGES CXX VERSION 1.0)
+
+# --------------------------------------------------------------------------------------------------------
+# Create executable
+# --------------------------------------------------------------------------------------------------------
+
+add_executable(${PROJECT_NAME} "main.cpp")
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
+set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON)
+
+# --------------------------------------------------------------------------------------------------------
+# Link libraries
+# --------------------------------------------------------------------------------------------------------
+
+include(FetchContent)
+
+FetchContent_Declare(
+ saucer
+ GIT_REPOSITORY "https://github.com/saucer/saucer"
+ GIT_TAG v$VERSION$
+)
+
+FetchContent_MakeAvailable(saucer)
+
+target_link_libraries(${PROJECT_NAME} PRIVATE saucer::saucer)
diff --git a/docs/getting-started/basic-app.mdx b/docs/getting-started/basic-app.mdx
index 72c19ef..7a3bf21 100644
--- a/docs/getting-started/basic-app.mdx
+++ b/docs/getting-started/basic-app.mdx
@@ -2,6 +2,9 @@
sidebar_position: 2
---
+import { VersionedCode } from '../../src/components/CodeBlock';
+import baseCmake from './basic-app.cmake';
+
# Your First Application
> On this page you'll learn how to setup your very first saucer project.
@@ -14,34 +17,9 @@ Make sure you've read the previous pages and have the system dependencies instal
In this example I'll use CMake as my build system of choice and make saucer available through [FetchContent](installation).
-```cmake title="CMakeLists.txt"
-cmake_minimum_required(VERSION 3.21)
-project(your_awesome_app LANGUAGES CXX VERSION 1.0)
-
-# --------------------------------------------------------------------------------------------------------
-# Create executable
-# --------------------------------------------------------------------------------------------------------
-
-add_executable(${PROJECT_NAME} "main.cpp")
-target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
-set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON)
-
-# --------------------------------------------------------------------------------------------------------
-# Link libraries
-# --------------------------------------------------------------------------------------------------------
-
-include(FetchContent)
-
-FetchContent_Declare(
- saucer
- GIT_REPOSITORY "https://github.com/saucer/saucer"
- GIT_TAG v2.0.0
-)
-
-FetchContent_MakeAvailable(saucer)
-
-target_link_libraries(${PROJECT_NAME} PRIVATE saucer::saucer)
-```
+
+ {baseCmake}
+
## The Program
diff --git a/docs/getting-started/installation.mdx b/docs/getting-started/installation.mdx
index a4b5dc7..ee2b518 100644
--- a/docs/getting-started/installation.mdx
+++ b/docs/getting-started/installation.mdx
@@ -4,6 +4,7 @@ sidebar_position: 0
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
+import { VersionedCode } from '../../src/components/CodeBlock';
# Installation
@@ -23,13 +24,14 @@ To get started choose your desired installation method below.
I recommend [CPM](https://github.com/cpm-cmake/CPM.cmake) for managing dependencies with CMake.
Please refer to their [docs](https://github.com/cpm-cmake/CPM.cmake#adding-cpm) on how to install it.
-```cmake
-CPMFindPackage(
+
+
+ {`CPMFindPackage(
NAME saucer
- VERSION 2.0.0
+ VERSION $VERSION$
GIT_REPOSITORY "https://github.com/saucer/saucer"
-)
-```
+)`}
+
Now you can simply link your project against saucer.
diff --git a/src/components/CodeBlock.tsx b/src/components/CodeBlock.tsx
new file mode 100644
index 0000000..8e9779a
--- /dev/null
+++ b/src/components/CodeBlock.tsx
@@ -0,0 +1,27 @@
+import CodeBlock, { Props } from "@theme/CodeBlock";
+import React, { useEffect, useState } from "react";
+
+export function VersionedCode({ children, ...props }: Props)
+{
+ const [version, setVersion] = useState("v2.0.1");
+
+ useEffect(() =>
+ {
+ fetch("https://api.github.com/repos/saucer/saucer/releases/latest", { headers: [
+ ["Accept", "application/vnd.github+json"],
+ ["X-GitHub-Api-Version", "2022-11-28"]
+ ] }).then(data =>
+ {
+ data.json().then(json =>
+ {
+ setVersion(json["tag_name"] ?? version);
+ });
+ });
+
+
+ }, []);
+
+ return
+ {children.toString().replace("$VERSION$", version.replace(/[^0-9.]/, ""))}
+ ;
+}