From 2c4d4994ac83401a79c577ae8c3717c92cc4c3d6 Mon Sep 17 00:00:00 2001 From: Blerim Sheqa Date: Mon, 14 Jul 2025 10:52:37 +0200 Subject: [PATCH] Replace image URLs for index page --- build-docs.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build-docs.rb b/build-docs.rb index 0720ab8..d41482d 100755 --- a/build-docs.rb +++ b/build-docs.rb @@ -241,8 +241,9 @@ main_pages = build_page_index(full_docs_dir, project_config['project']['docs_dir index_file = "#{clone_target}/index.md" FileUtils.cp("#{clone_target}/#{main_pages[0].values[0]}", index_file) index_content = File.read(index_file) -index_new_content = index_content.gsub(/\(((?!http)\S+(\.md|\.png)(\w)?)/, - "(#{project_config['project']['docs_dir']}/\\1") +index_new_content = index_content.gsub(/\(((?!http)\S+(\.md|\.png)(\w)?)/, "(#{project_config['project']['docs_dir']}/\\1") +# Fix image URLs +index_new_content = index_new_content.gsub(/(\[\!\[.*\])\(((?!http)\S+.png)\)/, "\\1(#{project_config['project']['docs_dir']}/\\2)") File.open(index_file, "w") {|file| file.puts index_new_content } mkdocs['nav'].push('' => "index.md")