linkaudit package#

Submodules#

linkaudit.html_result module#

License GPL3

  1. 2024-2025 Created by Maikel Mardjan - https://nocomplexity.com/

Function to create a HTML result file of a linkaudit run

linkaudit.html_result.create_output_htmlfile(result, filename)[source]#

Creates a clean output.html file of the input given

linkaudit.html_result.generate_html_table(data)[source]#

Generates an HTML table for entries with status != 200.

Parameters:

data (list of dict) – A list of dictionaries with ‘line_number’, ‘url’, and ‘status’ keys.

Returns:

A string containing the HTML table.

Return type:

str

linkaudit.linkaudit module#

License GPL3

  1. 2024-2025 Created by Maikel Mardjan - https://nocomplexity.com/

Simple Link checker for JupyterBook markdown files. Simplifies maintenance for dead URLs in JupyterBook projects.

async linkaudit.linkaudit.async_checkurl(url)[source]#

The async version Checks the status of a given URL and reports HTTP status codes or DNS errors.

Parameters:

url (str) – The URL to check.

Returns:

A tuple containing the URL and either the status code or an error message.

Return type:

tuple

Checks all URLs in a markdown file

linkaudit.linkaudit.check_md_files(bookdirectory, result_output='H')[source]#

Print txt tables of URLs checks of JB Book :param bookdirectory: The path to the directory containing Markdown files to analyze. :type bookdirectory: str :param result_output: Output format, “H” for HTML (default) or “T” for TXT.

Overridden by user input during execution.

Returns:

Outputs either “linkaudit_result.html” or “linkaudit_result.md” based on user choice.

Return type:

None

linkaudit.linkaudit.display_help()[source]#

Prints linkaudit help text

linkaudit.linkaudit.display_version()[source]#

Prints the module version. Use [-v] [–v] [-version] or [–version].

linkaudit.linkaudit.main()[source]#
async linkaudit.linkaudit.process_multiple_urlchecks(urls)[source]#

Process multiple URLs asynchronously.

Shows all URLs from MyST Markdown files in a directory and generates an HTML report.

Parameters:

bookdirectory (str) – The path to the directory containing Markdown files to analyze.

Returns:

Outputs an HTML file named “linkaudit_result.html” with the report.

Return type:

None

linkaudit.markdownhelpers module#

License GPL3 (C) 2024-2025 Created by Maikel Mardjan - https://nocomplexity.com/

Help functions for dealing with markdown files, especially MyST.

linkaudit.markdownhelpers.collect_markdown_files(directory)[source]#

Collects all Markdown files (.md) from a directory, including subdirectories, while skipping directories named ‘_build’, ‘_static’, and any directories starting with a dot (e.g., ‘.git’, ‘.env’).

Parameters:

directory (str) – The path to the directory to search.

Returns:

A list of paths to Markdown files.

Return type:

list

linkaudit.markdownhelpers.create_markdown_table(data)[source]#

Creates a markdown table from a list of dictionaries.

Parameters:

data (list of dicts) – A list of dictionaries with ‘line_number’, ‘url’, and ‘status’ keys.

Returns:

A markdown table string.

Return type:

str

linkaudit.markdownhelpers.extract_urls_from_markdown(markdown_text)[source]#

Extracts all URLs from a Markdown or MyST Markdown file, including multiple URLs in a single line.

Parameters:

markdown_text (str) – The content of the Markdown file.

Returns:

A list of extracted URLs.

Return type:

list

Checks all URLs in a markdown file

linkaudit.nocxhelpers module#

License GPL3

  1. 2024-2025 Created by Maikel Mardjan - https://nocomplexity.com/

Generic helper function(s).

linkaudit.nocxhelpers.printProgressBar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='█', printEnd='\r')[source]#

Call in a loop to create terminal progress bar @params:

iteration - Required : current iteration (Int) total - Required : total iterations (Int) prefix - Optional : prefix string (Str) suffix - Optional : suffix string (Str) decimals - Optional : positive number of decimals in percent complete (Int) length - Optional : character length of bar (Int) fill - Optional : bar fill character (Str) printEnd - Optional : end character (e.g. “

“, ” “) (Str)