Check markdown files for syntax
authorColin Clark <colin.clark@cclark.uk>
Mon, 25 Dec 2023 14:25:04 +0000 (14:25 +0000)
committerColin Clark <colin.clark@cclark.uk>
Mon, 25 Dec 2023 14:25:04 +0000 (14:25 +0000)
- Include markdown checks using mdl - different methods are used for
local checks and GitHub actions
- Fix syntax errors in some .md files

.github/workflows/check-build-actions.yml
.mdl.rb [new file with mode: 0644]
.mdlrc [new file with mode: 0644]
DEVELOPER-NOTES.md
README.md
doxygen.conf
meson.build

index 3bd3425..598303e 100644 (file)
@@ -2,6 +2,13 @@ name: Geeqie check build
 run-name: ${{ github.actor }} is running Geeqie check build
 on: [push, pull_request]
 jobs:
+  Check-Markdown:
+    runs-on: ubuntu-22.04
+    steps:
+    - uses: actions/checkout@v2
+    - name: Run Markdown Lint
+      uses: actionshub/markdownlint@main
+
   Check-Build-No-Options:
     runs-on: ubuntu-22.04
     steps:
diff --git a/.mdl.rb b/.mdl.rb
new file mode 100644 (file)
index 0000000..67e0157
--- /dev/null
+++ b/.mdl.rb
@@ -0,0 +1,7 @@
+# Style settings for markdownlint (mdl)
+
+all
+rule 'MD007', :indent => 4
+rule 'MD009', :br_spaces => 2
+rule 'MD010', :code_blocks => true
+exclude_rule 'MD013'
diff --git a/.mdlrc b/.mdlrc
new file mode 100644 (file)
index 0000000..a2e7196
--- /dev/null
+++ b/.mdlrc
@@ -0,0 +1,3 @@
+# markdownlint (mdl) configuration file
+
+style '.mdl.rb'
index a78d324..3a9f2b8 100644 (file)
@@ -1,21 +1,25 @@
 # Additional Information for Developers
 
-
 ## Non-standard icons
 
-#### Collection drag-drop icon
+### Collection drag-drop icon
 
 #### ![][image_ref_gq_marker_png]
+
 Used when dropping images onto a Collection.
 Defined in `./src/icons/gq-marker.xpm`.
 
-#### Overlay Screen Display icons
+### Overlay Screen Display icons
+
+#### ![][image_ref_image_osd_color_png] IMAGE_OSD_COLOR
+
+#### ![][image_ref_image_osd_first_png] IMAGE_OSD_FIRST
 
-##### ![][image_ref_image_osd_color_png] IMAGE_OSD_COLOR
-##### ![][image_ref_image_osd_first_png] IMAGE_OSD_FIRST
-##### ![][image_ref_image_osd_icon_png] IMAGE_OSD_ICON
-##### ![][image_ref_image_osd_last_png] IMAGE_OSD_LAST
-##### ![][image_ref_image_osd_rotate_auto_png] IMAGE_OSD_ROTATE_AUTO
+#### ![][image_ref_image_osd_icon_png] IMAGE_OSD_ICON
+
+#### ![][image_ref_image_osd_last_png] IMAGE_OSD_LAST
+
+#### ![][image_ref_image_osd_rotate_auto_png] IMAGE_OSD_ROTATE_AUTO
 
 Shown in the Overlay Screen Display. Defined in `./src/image-overlay.cc image_osd_icon_pixbuf()`.
 
@@ -24,6 +28,7 @@ Shown in the Overlay Screen Display. Defined in `./src/image-overlay.cc image_os
 Menu processing is in `./src/layout-util.cc menu_entries[]`.
 
 ## Doxygen Documentation
+
 Complete code documentation in html format can be generated via the script `./scripts/doxygen.sh`.
 
 [image_ref_image_osd_color_png]:
index fe96036..4c7a025 100644 (file)
--- a/README.md
+++ b/README.md
@@ -10,7 +10,6 @@ Package Status:
 Geeqie website status:  
 [![Links Status](https://github.com/geeqie/geeqie.github.io/actions/workflows/links.yml/badge.svg)]()
 
-
 ## ![][image_ref_geeqie_png] Geeqie - an image viewer
 
 This is Geeqie, a successor of GQview.
index 57640cb..d867f43 100644 (file)
@@ -924,6 +924,7 @@ FILE_PATTERNS          = *.c \
                          *.m \
                          *.markdown \
                          *.md \
+                         *.rb \
                          *.mm \
                          *.dox \
                          *.py \
index a77a108..b0c8f13 100644 (file)
@@ -633,6 +633,9 @@ configure_file(input : 'config.h.in',
 script_sources = []
 subdir('scripts')
 
+# For markdownlint on .md files
+mdl_sources = []
+
 # For gtk builder checks on .ui files
 ui_sources = []
 
@@ -721,6 +724,31 @@ else
     summary({'shellcheck' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
 endif
 
+# Markdownlint
+option = get_option('archive')
+if option.disabled()
+    mdl_exe = find_program('mdl', required : false)
+
+    if mdl_exe.found()
+        mdl_sources += files('CHECKLIST.md',
+        'CODING.md',
+        'DEVELOPER-NOTES.md',
+        'README.md',
+        join_paths(meson.project_source_root(), '.github', 'ISSUE_TEMPLATE.md'))
+
+        style = join_paths(meson.project_source_root(), '.mdl.rb')
+        foreach md_file : mdl_sources
+            md_path = '@0@'.format(md_file)
+            test('Mdl_check_ ' + md_path, mdl_exe, args: ['--style', style, md_file], timeout: 100)
+        endforeach
+        summary({'markdownlint' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
+    else
+        summary({'markdownlint' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
+    endif
+else
+    summary({'markdownlint' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
+endif
+
 # GtkBuilder .ui check
 option = get_option('archive')
 if option.disabled()