Coder Social home page Coder Social logo

melvio / markdown_articles_tool Goto Github PK

View Code? Open in Web Editor NEW

This project forked from artiomn/markdown_articles_tool

0.0 0.0 0.0 82 KB

Parse markdown article, download images and replace images URL's with local paths

License: MIT License

Python 100.00%

markdown_articles_tool's Introduction

Python application

Markdown articles tool 0.0.7

Tool can be used:

  • To download markdown article with images and replace image links.
    Find all links to images, download images and fix links in the document. Similar images may be deduplicated by content hash.
  • Support images, linked with HTML "<img>" tag.
  • Convert Markdown documents to:
    • HTML.
    • PDF.
    • Or save in the plain Markdown.

Installation

You need Python 3.7+.
Run:

git clone "https://github.com/artiomn/markdown_articles_tool"
pip3 install -r markdown_articles_tool/requirements.txt

Usage

Syntax:

usage: markdown_tool.py [-h] [-D] [-d IMAGES_DIRNAME] [-a] [-s SKIP_LIST]
                        [-i {md,html,md+html,html+md}] [-o {md,html,pdf}]
                        [-p IMAGES_PUBLIC_PATH] [-R] [-t DOWNLOADING_TIMEOUT]
                        [-O OUTPUT_PATH] [--version]
                        article_file_path_or_url

Simple script to download images and replace image links in markdown
documents.

positional arguments:
  article_file_path_or_url
                        path to the article file in the Markdown format

optional arguments:
  -h, --help            show this help message and exit
  -D, --dedup-with-hash
                        Deduplicate images, using content hash
  -d IMAGES_DIRNAME, --images-dirname IMAGES_DIRNAME
                        Folder in which to download images (possible
                        variables: $article_name, $time, $date, $dt,
                        $base_url)
  -a, --skip-all-incorrect
                        skip all incorrect images
  -s SKIP_LIST, --skip-list SKIP_LIST
                        skip URL's from the comma-separated list (or file with
                        a leading '@')
  -i {md,html,md+html,html+md}, --input-format {md,html,md+html,html+md}
                        input format
  -o {md,html,pdf}, --output-format {md,html,pdf}
                        output format
  -p IMAGES_PUBLIC_PATH, --images-public-path IMAGES_PUBLIC_PATH
                        Public path to the folder of downloaded images
                        (possible variables: $article_name, $time, $date, $dt,
                        $base_url)
  -R, --remove-source   Remove or replace source file
  -t DOWNLOADING_TIMEOUT, --downloading-timeout DOWNLOADING_TIMEOUT
                        how many seconds to wait before downloading will be
                        failed
  -O OUTPUT_PATH, --output-path OUTPUT_PATH
                        article output file name
  --version             return version number

Example 1:

./markdown_tool.py nc-1-zfs/article.md

Example 2:

./markdown_tool.py not-nas/sov/article.md -o html -s "http://www.ossec.net/_images/ossec-arch.jpg" -a

Example 3 (run on a folder):

find content/ -name "*.md" | xargs -n1 ./markdown_tool.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.