Skip to content

A utility to convert the navigation sidebar of GitHub documentation pages from HTML to a structured Markdown format.

Notifications You must be signed in to change notification settings

brlin-tw/github-docs-nav-sidebar-to-markdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

(WIP) GitHub documentation navigation sidebar to Markdown converter

A utility to convert the navigation sidebar of GitHub documentation pages from HTML to a structured Markdown format.

https://gitlab.com/brlin/github-docs-nav-sidebar-to-markdown
The GitLab CI pipeline status badge of the project's main branch GitHub Actions workflow status badge pre-commit enabled badge REUSE Specification compliance badge

#utility #github-docs #markdown

Introduction

This script converts the GitHub Actions documentation sidebar HTML structure to a GitHub Flavored Markdown (GFM) unordered list format.

The script extracts:

  • Text content from span elements with class "prc-ActionList-ItemLabel-TmBhn"
  • URL links from href attributes of anchor elements
  • Hierarchical structure based on CSS depth indicators (--subitem-depth)

Usage

Refer to the following instructions to run the conversion script:

  1. Install the following runtime dependencies:

  2. Copy the HTML snippet of the sidebar into a local file, e.g., sidebar.html, refer to the sample HTML file for an example.

  3. Edit the html_to_markdown_converter.py script to:

    • Set the input HTML file path and output Markdown file path.
    • Edit the class_ variables according to the actual HTML structure if necessary.
  4. Launch a text terminal.

  5. Change the working directory to where you saved the html_to_markdown_converter.py script.

  6. Run the following command to run the utility:

    python3 html_to_markdown_converter.py

    The converted Markdown content will be saved to the specified output file.

References

The following materials are referenced during the development of this product:

Licensing

Unless otherwise noted(comment headers/REUSE.toml), this product is licensed under the 3.0 version of the Affero General Public License, or any of its more recent versions of your preference.

This work complies to the REUSE Specification, refer to the REUSE - Make licensing easy for everyone website for info regarding the licensing of this product.

About

A utility to convert the navigation sidebar of GitHub documentation pages from HTML to a structured Markdown format.

Topics

Resources

Stars

Watchers

Forks