markdownload
                                
                                
                                
                                    markdownload copied to clipboard
                            
                            
                            
                        Split readability/turndown parsing logic into library, use Typescript, provide web API, UI and bookmarklet
Hey folks,
I hope you're all doing well! I wanted to bring up some ideas that could improve MarkDownload and make it more accessible to a wider range of users and developers. I think we should split the readability/turndown parsing logic into a separate library, adopt TypeScript, and provide a web API, UI and bookmarklet, for these reasons:
Modularity and reusability: By extracting the readability/turndown parsing logic into a standalone library, other projects and developers could leverage this great functionality without duplicating efforts, promoting collaboration and speeding up development. Currently there is around 1,000 lines of custom parsing code in background.js that handles normalizing URLs, handling images, and parsing KaTex, MathJax, and code snippets, and more. It would be great if other devs could reuse this work.
Improved maintainability: Separating the parsing logic into a dedicated library makes it easier to maintain and update. We can focus on refining the parsing algorithms, fixing bugs, and adding new features without worrying about the complexities of running/testing a browser extension. This could be useful because this project is likely abandoned/not maintained, see #233.
Type safety with TypeScript: TypeScript has gained significant popularity in the developer community due to its static typing and improved tooling. By migrating to TypeScript, we can catch potential errors during development, enhance code readability, and provide better documentation for future contributors or users of the library.
Web API, UI, and bookmarklet for broader integration: Providing a web API for the parsing library opens up a whole new world of possibilities. Other applications, services, and frameworks could seamlessly integrate the parsing functionality, expanding MarkDownload's reach and encouraging collaboration. With a simple UI, people could use the tool without downloading an extension, and we could even make it a bookmarklet that loads our library from a CDN and starts the download via JS.
I know this could have been written in several issues but thought it would be good to centralize it. I might have time to do some of this, so I'll update you if I do.