shahednasser / cross-post

Cross Post a blog to multiple websites
https://www.npmjs.com/package/cross-post-blog
MIT License
122 stars 16 forks source link

Fixes and updates #45

Open iwaduarte opened 1 year ago

iwaduarte commented 1 year ago

hi @shahednasser,

I have created several functions on this PR.

The main goal is to allow more freedom when deploying locally using markdown files. The functions could be extended to other parts of the code yet I wanted to keep it simple to make a point that we probably do not need to rely on selectors

crosspost run -l

This command goes to a remote location where the blog is already posted. It grabs the HTML and will apply some algorithms to determine the main content div (instead of the --selector approach). It will then merge the src images with the markdown . i.e whatever => [whatever](https://localcanonicalurl.com/doggoimage.png

The approach is to use text density and specific text tags and try to match the common nearest selector between these.

I have also added a cross configuration between OS in this repo in order to prevent conflict between two different environments (CRLF vs. LF). I use Windows and you probably use macOS.

I have added JSDOC style docs to the function the way you used across the files. It is worth noting that I code a little bit differently than this current codebase. If you need me to change anything please let me know.

I have also added a few fixes that were breaking the cli, fixed some eslint complaining and all. Hope it is okay. Thanks again. Anything let me know. 👍

iwaduarte commented 1 year ago

@shahednasser Yeah sure. I will add a line to the README.md