A Flask web application that reformats Microsoft Learning modules into a clean, reader-friendly format while preserving navigation and content structure.
- Clean Reading Experience: Removes clutter and provides better typography for extended reading
- Preserved Navigation: Maintains module structure with sidebar navigation
- Image Support: Properly displays images and diagrams from Microsoft Learn
- Table Formatting: Preserves and styles tables appropriately
- Mobile Responsive: Works on desktop and mobile devices
- Real-time Loading: Uses HTMX for seamless content loading without page refreshes
- Python 3.7+
- Flask
- BeautifulSoup4
- Requests
- Clone the repository:
git clone <repository-url>
cd mslearn-reader- Install dependencies:
pip install -r requirements.txt- Create the templates directory and add template files:
mslearn-reader/
├── app.py
├── requirements.txt
└── templates/
├── index.html
├── navigation.html
└── content.html
- Start the Flask development server:
python app.py- Open your browser and navigate to:
http://localhost:5000
- Enter a Microsoft Learning module URL in the format:
https://learn.microsoft.com/en-us/training/modules/[module-name]/
-
Click "Load Module" to fetch and format the content
-
Use the sidebar navigation to browse through different sections
The application:
- Fetches Module Structure: Parses the main module page to extract navigation links
- Loads Individual Sections: Fetches each unit/section page separately
- Cleans Content: Removes unnecessary elements while preserving text, images, and tables
- Fixes URLs: Converts relative image and link URLs to absolute URLs
- Applies Styling: Uses clean typography and layout for better readability
- MSLearnParser Class: Core parsing logic for extracting and cleaning content
- Flask Routes: Web interface for loading modules and sections
- HTMX Integration: Real-time content updates without page refreshes
- Template System: Modular HTML templates for different components
The application includes several configurable aspects:
- Typography: Warm beige background (#faf8f5) for reduced eye strain
- Content Cleaning: Removes navigation, headers, footers while preserving main content
- Image Processing: Handles Microsoft Learn's relative path structure
- Debug Logging: Comprehensive logging for troubleshooting
- Check console output for debug information
- Verify the Microsoft Learn URL is valid
- Ensure network connectivity
- Check browser developer tools for failed image requests
- Verify image URLs are being converted correctly in console output
- Restart Flask server if templates were modified
- Clear browser cache for CSS/JS changes
The application includes extensive debug logging. Check the console output for:
- Module parsing information
- Image URL conversion details
- Section loading progress
- Error messages and stack traces
- Edit files in the
templates/directory - Restart Flask server for changes to take effect
- Use hard refresh (Ctrl+F5) to clear browser cache
- Only works with Microsoft Learning modules
- Requires internet connection to fetch content
- Some advanced interactive elements may not be preserved
- Content is fetched in real-time (no caching)
[Add your license here]
[Add contribution guidelines here]