Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
7a208d8
Add schema documentation generation script and update project configu…
mokhld Apr 3, 2025
f71a7f8
test: comment out failing tests
mokhld Apr 4, 2025
ddc37cc
chore(sonar): test comment and sonar things
mokhld Apr 4, 2025
aeb4320
chore: Enhance documentation generation workflow and update .gitignore
mokhld Apr 4, 2025
57d66af
lint: trailing whitespace etc
mokhld Apr 4, 2025
a5d8c11
fix: make execSync safe
mokhld Apr 4, 2025
6713cc1
chore: update .gitignore to exclude temp-schemas
mokhld Apr 4, 2025
3a70199
chore: update test documentation generation workflow to handle pull r…
mokhld Apr 4, 2025
2ba1a89
chore: refine documentation generation workflow for pull requests
mokhld Apr 4, 2025
5a27570
chore: update documentation generation workflow to trigger on specifi…
mokhld Apr 4, 2025
379e703
chore: correct file dir
mokhld Apr 4, 2025
1aef164
chore: fix formatting in documentation generation workflow for pull r…
mokhld Apr 4, 2025
ec0501b
chore: enhance documentation generation workflow with markdown conver…
mokhld Apr 4, 2025
ffe72ee
chore: update documentation generation workflow to prepare Jekyll site
mokhld Apr 4, 2025
2082a10
chore: enhance Jekyll configuration in documentation generation workflow
mokhld Apr 4, 2025
9056f2d
chore: update documentation generation workflow to include Ruby setup…
mokhld Apr 4, 2025
2d8b033
chore: include minima theme in Jekyll installation for documentation …
mokhld Apr 4, 2025
1883847
chore: add front matter to INDEX.md for Jekyll documentation layout a…
mokhld Apr 4, 2025
b879c4d
chore: update documentation generation workflow to use remote theme a…
mokhld Apr 4, 2025
b52ff9d
chore: update INDEX.md layout for Jekyll documentation
mokhld Apr 4, 2025
8862a8b
chore: enhance Jekyll installation in documentation generation workflow
mokhld Apr 4, 2025
ba6a651
chore: refactor Jekyll installation in documentation generation workflow
mokhld Apr 4, 2025
b39a4f4
chore: simplify Bundler configuration in documentation generation wor…
mokhld Apr 4, 2025
bdad158
chore: Added jekyll-seo-tag to the Gemfile for enhanced SEO support.
mokhld Apr 4, 2025
7c2e8e9
chore: improve documentation generation workflow by refining INDEX.md…
mokhld Apr 4, 2025
6197d49
chore: enhance documentation generation workflow by injecting front m…
mokhld Apr 4, 2025
4e20de4
chore: refine documentation generation workflow with liquid tag fixes…
mokhld Apr 4, 2025
c16592d
chore: enhance documentation generation workflow with specific file f…
mokhld Apr 4, 2025
8e84b2f
chore: enhance documentation generation workflow with improved file p…
mokhld Apr 4, 2025
40fcb70
chore: refine documentation generation workflow with enhanced Liquid …
mokhld Apr 4, 2025
7470c4e
chore: enhance documentation generation workflow with improved awk sc…
mokhld Apr 4, 2025
d8497bb
chore: update awk scripts in documentation generation workflow for im…
mokhld Apr 4, 2025
8150133
chore: simplify PAGE_TEMPLATES.md processing in documentation generat…
mokhld Apr 4, 2025
b06912e
chore: add scripts for Jekyll configuration and schema documentation …
mokhld Apr 7, 2025
404ceb0
chore: enhance documentation processing script with base directory su…
mokhld Apr 7, 2025
92c1415
chore: improve front matter processing in documentation scripts
mokhld Apr 7, 2025
83dcce6
chore: refine schema link processing and front matter handling in doc…
mokhld Apr 7, 2025
7cb56c4
chore: update Jekyll configuration script with additional gems for en…
mokhld Apr 7, 2025
83bc7ca
chore: update workflow to use remote theme and relative links
mokhld Apr 7, 2025
bf4b643
chore: enhance documentation generation workflow with case sensitivit…
mokhld Apr 7, 2025
93f94b6
chore: update documentation generation workflow with improved link ha…
mokhld Apr 7, 2025
59b5021
lint: some fixes
mokhld Apr 7, 2025
f073fa5
chore: enhance documentation generation with link fixing and front ma…
mokhld Apr 7, 2025
d975c75
chore: add script for fixing documentation issues and enhance workflow
mokhld Apr 7, 2025
931d7a1
fix: improve Liquid template wrapping in documentation script
mokhld Apr 7, 2025
bf65982
docs: update PAGE_EVENTS documentation for clarity and formatting
mokhld Apr 7, 2025
97bc2cc
docs: update PAGE_EVENTS documentation to include raw Liquid syntax
mokhld Apr 7, 2025
9e97aa5
fix: enhance Liquid syntax handling in fix-docs.sh script
mokhld Apr 7, 2025
0ed1bd3
fix: improve documentation processing in fix-docs.sh script
mokhld Apr 7, 2025
9f75063
fix: enhance directory detection and processing in fix-docs.sh script
mokhld Apr 7, 2025
66c0bcb
docs: update Liquid syntax in documentation for consistency
mokhld Apr 7, 2025
b32786e
fix: standardize Liquid syntax references in documentation
mokhld Apr 8, 2025
f8e92dd
fix: correct Liquid syntax in PAGE_EVENTS documentation
mokhld Apr 8, 2025
bd52765
feat: enhance Jekyll configuration and documentation processing
mokhld Apr 8, 2025
30f4840
refactor: update Jekyll config script and enhance schema documentation
mokhld Apr 8, 2025
3ebddac
feat: enhance Jekyll configuration and documentation processing
mokhld Apr 8, 2025
a61bd29
refactor: simplify admonition processing in documentation script
mokhld Apr 8, 2025
b804201
feat: enhance documentation processing and Jekyll configuration
mokhld Apr 8, 2025
5e7213b
refactor: enhance documentation processing in fix-docs.sh
mokhld Apr 8, 2025
c3680c7
feat: update Jekyll configuration and enhance asset handling
mokhld Apr 8, 2025
c15f3c0
feat: enhance Jekyll configuration and improve documentation clarity
mokhld Apr 8, 2025
93db78e
feat: update Jekyll configuration to improve asset handling and exclu…
mokhld Apr 8, 2025
3ef1ea9
feat: enhance Jekyll configuration for asset management
mokhld Apr 8, 2025
c9ac0d6
fix: disable Liquid rendering for asset files in Jekyll configuration
mokhld Apr 8, 2025
68680ad
fix: enable Liquid rendering for asset files in Jekyll configuration
mokhld Apr 8, 2025
78ca4a4
fix: update Jekyll configuration to exclude additional vendor directo…
mokhld Apr 8, 2025
1ca8918
fix: update Jest configuration and enhance schema documentation gener…
mokhld Apr 8, 2025
2eabb47
fix: update Jest configuration to include coverage for scripts directory
mokhld Apr 8, 2025
5471c5c
feat: add GitHub Actions workflow for documentation generation
mokhld Apr 8, 2025
b3a1b32
lint: fix linting erros
mokhld Apr 8, 2025
419d0bd
fix: improve schema documentation generation and logging
mokhld Apr 8, 2025
dd91e3e
chore: update documentation generation workflow and improve links in …
mokhld Apr 8, 2025
0ec88e5
docs: update links in PAGE_VIEWS.md and PAGE_EVENTS.md for consistency
mokhld Apr 8, 2025
d44c497
test: enhance generate-schema-docs test suite with new cases
mokhld Apr 8, 2025
477701d
docs: enhance Jekyll configuration and documentation structure
mokhld Apr 9, 2025
d795dbe
Revert "docs: enhance Jekyll configuration and documentation structure"
mokhld Apr 9, 2025
6cbad72
docs: refine Jekyll configuration and enhance features navigation
mokhld Apr 9, 2025
03a64c2
fix: missing EOF
mokhld Apr 9, 2025
0ff0e14
docs: update schemas/index.md to exclude from navigation
mokhld Apr 9, 2025
23f87c8
docs: streamline Jekyll configuration and link management
mokhld Apr 9, 2025
aa29663
docs: update title in Jekyll configuration for consistency
mokhld Apr 9, 2025
2c35b21
docs: add custom SCSS for styling overrides in Jekyll configuration
mokhld Apr 9, 2025
2c7107e
docs: update Jekyll configuration to streamline SCSS handling and rem…
mokhld Apr 9, 2025
94381ee
docs: improve link handling in documentation scripts
mokhld Apr 9, 2025
9ee1a50
docs: enhance link processing in fix-schema-links.sh
mokhld Apr 9, 2025
22ddd9c
docs: update links in documentation for consistency
mokhld Apr 9, 2025
6829848
docs: enhance link handling in documentation scripts
mokhld Apr 9, 2025
f45e17f
docs: refine schema link handling in fix-schema-links.sh and update w…
mokhld Apr 9, 2025
87bef5d
docs: update link in CONTRIBUTING.md for clarity
mokhld Apr 10, 2025
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
25 changes: 25 additions & 0 deletions .github/scripts/docs/assets/fix-links.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
document.addEventListener('DOMContentLoaded', function () {
// Fix all links that should have the baseurl
document.querySelectorAll('a').forEach(function (link) {
const href = link.getAttribute('href')

// Skip links that already have the baseurl or are external or anchors
if (
href.includes('/forms-engine-plugin') ||
href.match(/^https?:\/\//) ||
href.startsWith('#')
) {
return
}

// Fix schema links specifically
if (href.includes('schemas/') || href.startsWith('/schemas/')) {
link.href =
'/forms-engine-plugin' + (href.startsWith('/') ? '' : '/') + href
}
// Fix other internal links that start with /
else if (href.startsWith('/')) {
link.href = '/forms-engine-plugin' + href
}
})
})
6 changes: 6 additions & 0 deletions .github/scripts/docs/assets/scss/custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@media (min-width: 50rem) {
.site-title {
padding-right: 1rem;
padding-left: 1rem;
}
}
204 changes: 204 additions & 0 deletions .github/scripts/docs/create-jekyll-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
#!/bin/bash
# Script to create Jekyll configuration files
# This script creates the Gemfile and _config.yml for the Jekyll site

echo "📝 Creating Jekyll configuration files..."

# Set up sed in-place flag based on OS
if sed --version 2>&1 | grep -q GNU; then
# GNU sed (Linux)
SED_INPLACE=(-i)
else
# BSD sed (macOS)
SED_INPLACE=(-i "")
fi

# Create Gemfile
echo "📄 Creating Gemfile..."
cat > site-src/Gemfile << EOF
source 'https://rubygems.org'

gem 'jekyll', '~> 4.3.2'
gem 'just-the-docs', '~> 0.5.3'
gem 'jekyll-seo-tag'
gem 'jekyll-remote-theme'
gem 'jekyll-relative-links'
gem 'webrick' # required for Ruby 3.x
EOF

# Create _config.yml
echo "📄 Creating _config.yml..."
cat > site-src/_config.yml << EOF
title: DXT Documentation
description: Documentation for the DEFRA Forms Engine Plugin

# Theme configuration
remote_theme: just-the-docs/just-the-docs@v0.5.3
# Use this instead of remote_theme when running locally
# theme: just-the-docs

# URL configuration - ensure these are correct for GitHub Pages
url: ""
baseurl: "/forms-engine-plugin" # Use repo name for GitHub Pages

# Search and heading configuration
search_enabled: true
heading_anchors: true
search:
heading_level: 2
previews: 3
preview_words_before: 5
preview_words_after: 10
rel_url: true

# Navigation configuration
nav_external_links:
- title: GitHub
url: https://github.com/DEFRA/forms-designer
hide_icon: false

# Auxiliary links
aux_links:
"DXT on GitHub":
- "https://github.com/DEFRA/forms-designer"

# Include all necessary file types
include:
- "**/*.html"
- "**/*.json"
- "**/*.schema.json"
- "schemas/**/*"
- "assets/js/*.js"

# Tell Jekyll to EXCLUDE these directories completely
exclude:
- "vendor"
- "vendor/bundle/"
- "vendor/cache/"
- "vendor/gems/"
- "vendor/ruby/"
- "Gemfile"
- "Gemfile.lock"

# Markdown processing
markdown: kramdown
kramdown:
input: GFM
syntax_highlighter: rouge
syntax_highlighter_opts:
block:
line_numbers: false

# Color scheme
color_scheme: light

# Plugin configuration
plugins:
- jekyll-remote-theme
- jekyll-relative-links
- jekyll-seo-tag

# Asset configuration
assets:
self_contained: false
js_directory: /assets/js
compress:
js: false

# Link handling
relative_links:
enabled: true
collections: true

# Default layouts and configurations
defaults:
# Process JS files with Liquid but no layout
- scope:
path: "assets/js"
values:
layout: null
sitemap: false
render_with_liquid: true
# Then define all other defaults below
- scope:
path: "assets/css"
values:
layout: null
render_with_liquid: true
- scope:
path: ""
type: "pages"
values:
layout: default
render_with_liquid: false
- scope:
path: "schemas"
values:
layout: default
parent: "Schema Reference"


# Table of contents configuration
toc:
min_level: 1
max_level: 2 # Only show h1 and h2 in TOC

# Custom scripts
head_scripts:
- /assets/js/fix-links.js

# Handle assets correctly
keep_files:
- assets
EOF

echo "📝 Copying link-fixer JavaScript..."
mkdir -p site-src/assets/js
cp .github/scripts/docs/assets/js/fix-links.js site-src/assets/js/

mkdir -p site-src/_includes
cat > site-src/_includes/head_custom.html << 'EOF'
<meta name="baseurl" content="{{ site.baseurl }}">
EOF

echo "📝 Copying custom SCSS styling overrides..."
mkdir -p site-src/_sass/custom
cp .github/scripts/docs/assets/scss/custom.scss site-src/_sass/custom/custom.scss

# Features section - explicit configuration
- scope:
path: "features"
values:
nav_exclude: false

- scope:
path: "features/index.md"
values:
layout: default
title: "Features"
nav_order: 4
has_children: true
permalink: /features/
nav_exclude: false

- scope:
path: "features/code-based/index.md"
values:
layout: default
title: "Code-based Features"
parent: "Features"
has_children: true
nav_order: 1
nav_exclude: false

- scope:
path: "features/configuration-based/index.md"
values:
layout: default
title: "Configuration-based Features"
parent: "Features"
has_children: true
nav_order: 2
nav_exclude: false

echo "✅ Jekyll configuration files created successfully!"
153 changes: 153 additions & 0 deletions .github/scripts/docs/fix-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
#!/bin/bash
# fix-docs.sh - Script to fix documentation issues

echo "🔄 Processing documentation files..."

if sed --version 2>&1 | grep -q GNU; then
SED_INPLACE=(-i)
else
SED_INPLACE=(-i "")
fi

# IMPORTANT: Process both current directory AND docs/ directory for root files
echo "🔄 Processing root markdown files..."
for location in "." "docs"; do
if [ -d "$location" ]; then
echo " Checking $location directory"
for file in "$location"/*.md; do
if [ -f "$file" ]; then
echo " Processing $file"
temp_file="${file}.tmp"

awk '
/^> \[!NOTE\]/ {
print "{: .note }";
in_note = 1;
next;
}
/^> \[!TIP\]/ {
print "{: .highlight }";
in_note = 1;
next;
}
/^> \[!IMPORTANT\]/ {
print "{: .important }";
in_note = 1;
next;
}
/^> \[!WARNING\]/ {
print "{: .warning }";
in_note = 1;
next;
}
/^> \[!CAUTION\]/ {
print "{: .warning }";
in_note = 1;
next;
}
/^> / {
if(in_note) {
print substr($0, 3);
next;
}
}
{
in_note = 0;
print;
}
' "$file" > "$temp_file"

if [[ "$file" =~ GETTING_STARTED.md ]]; then
sed "${SED_INPLACE[@]}" 's|\[examples\](test/form/definitions)|\[examples\](https://github.com/DEFRA/forms-engine-plugin/tree/main/test/form/definitions)|g' "$temp_file"
fi

sed "${SED_INPLACE[@]}" 's|/forms-engine-plugin/forms-engine-plugin/|/forms-engine-plugin/|g' "$temp_file"

mv "$temp_file" "$file"
fi
done
fi
done

# Determine the correct docs path
if [ -d "docs/features" ]; then
DOCS_PATH="docs/features"
elif [ -d "../docs/features" ]; then
DOCS_PATH="../docs/features"
elif [ -d "features" ]; then
DOCS_PATH="features"
else
echo "❌ Cannot find docs/features directory!"
exit 1
fi

echo "Using docs path: $DOCS_PATH"

# Process each directory
for dir in code-based configuration-based; do
dir_path="$DOCS_PATH/$dir"
echo "Processing $dir_path directory..."

if [ ! -d "$dir_path" ]; then
echo "❌ Directory $dir_path not found!"
continue
fi

pushd "$dir_path" > /dev/null || exit 1

for file in *.md; do
echo " Processing $file"

temp_file="${file}.tmp"

awk '
/^> \[!NOTE\]/ {
print "{: .note }";
in_note = 1;
next;
}
/^> \[!TIP\]/ {
print "{: .highlight }";
in_note = 1;
next;
}
/^> \[!IMPORTANT\]/ {
print "{: .important }";
in_note = 1;
next;
}
/^> \[!WARNING\]/ {
print "{: .warning }";
in_note = 1;
next;
}
/^> \[!CAUTION\]/ {
print "{: .warning }";
in_note = 1;
next;
}
/^> / {
if(in_note) {
print substr($0, 3);
next;
}
}
{
in_note = 0;
print;
}
' "$file" > "$temp_file"

lowercase_file=$(echo "$file" | tr '[:upper:]' '[:lower:]')
if [ "$file" != "$lowercase_file" ]; then
echo " Creating lowercase copy: $lowercase_file"
cp "$temp_file" "$lowercase_file"
fi

mv "$temp_file" "$file"
done

popd > /dev/null
done

echo "✅ Documentation fixes applied successfully!"
Loading
Loading