diff --git a/.github/workflows/deploy-web.yml b/.github/workflows/deploy-web.yml index 437b3741..df82fe52 100644 --- a/.github/workflows/deploy-web.yml +++ b/.github/workflows/deploy-web.yml @@ -19,6 +19,9 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' - name: Install dependencies run: npm install @@ -29,7 +32,7 @@ jobs: wget https://github.com/matusnovak/doxybook2/releases/download/v1.5.0/doxybook2-linux-amd64-v1.5.0.zip unzip doxybook2-linux-amd64-v1.5.0.zip sudo cp bin/doxybook2 /usr/bin - # bash ./Scripts/CreateCppDocs.sh + bash ./Scripts/CreateCppDocs.sh - name: Build website run: npm run docs:build diff --git a/Docs/.vitepress/config.ts b/Docs/.vitepress/config.ts index 38fdf41a..09bdbf57 100644 --- a/Docs/.vitepress/config.ts +++ b/Docs/.vitepress/config.ts @@ -30,6 +30,7 @@ export default defineConfig({ // # Your title {#your-custom-id} // ``` markdown: { attrs: { disable: true } }, + ignoreDeadLinks: true, themeConfig: { // https://vitepress.dev/reference/default-theme-config nav: [ @@ -59,7 +60,6 @@ export default defineConfig({ { text: 'How to add new node', link: '/developer-guide/how-to-add-new-node' }, ] }, - /* { text: 'C++ API Reference', link: '/cpp-api-reference/', @@ -70,7 +70,6 @@ export default defineConfig({ ...autogenerate('Namespaces', 'namespaces'), ] } - */ ], socialLinks: [ diff --git a/Scripts/CreateCppDocs.sh b/Scripts/CreateCppDocs.sh index 97eea9af..af2b6b34 100644 --- a/Scripts/CreateCppDocs.sh +++ b/Scripts/CreateCppDocs.sh @@ -7,13 +7,53 @@ # - doxygen # - doxybook2 -rm -rf Docs/Doxygen/xml -doxygen Docs/Doxygen/Doxyfile +MARKDOWN_DIR=Docs/cpp-api-reference -cd Docs -rm -rf cpp-api-reference && mkdir -p cpp-api-reference -doxybook2 --input Doxygen/xml --output cpp-api-reference --config Doxygen/doxybook2.json -cd - +function main() { + rm -rf Docs/Doxygen/xml + doxygen Docs/Doxygen/Doxyfile -# Replace
-# find Docs/cpp-api-reference -type f -name "*.md" | xargs sed -i 's/
//g' + rm -rf Docs/cpp-api-reference && mkdir -p "$MARKDOWN_DIR" + doxybook2 --input Docs/Doxygen/xml --output "$MARKDOWN_DIR" --config Docs/Doxygen/doxybook2.json + + # Find Markdown files in the specified directory and escape < and > in them + find "$MARKDOWN_DIR" -type f -name "*.md" -print0 | while IFS= read -r -d '' file; do + echo "Correcting file: $file" + escaped_content=$(escape_markdown "$file") + echo "$escaped_content" > "$file" + done +} + +# Function to escape < and > except within code blocks +function escape_markdown() { + python3 - $1 << 'EOF' +import re +import sys + +def escape_markdown(text): + # Define a pattern to match code blocks + code_block_pattern = re.compile(r'```.*?```', re.DOTALL) + + # Find code blocks and replace < and > inside them with placeholders + def escape_code_blocks(match): + code_block = match.group(0) + return code_block.replace('<', '\ufffe').replace('>', '\uffff') + + # Replace < and > outside of code blocks + escaped_text = code_block_pattern.sub(escape_code_blocks, text) + escaped_text = escaped_text.replace('<', '<').replace('>', '>') + + # Restore placeholders inside code blocks + escaped_text = escaped_text.replace('\ufffe', '<').replace('\uffff', '>') + + return escaped_text + +# Read Markdown file from "$file" +with open(sys.argv[1], 'r', encoding='utf-8') as file: + markdown_text = file.read() + escaped_text = escape_markdown(markdown_text) + print(escaped_text) +EOF +} + +main