Convert markdown to HTML using the GitHub API and some additional tweaks with Python.

Overview

brought to you by phseiff github flavored markdown to html, aka gh-md-to-html

PyPI download total PyPI version shields.io PyPI pyversions GitHub license Average time to resolve an issue Percentage of issues still open

A user-friendly python-module and command-line frontend to convert markdown to html. It uses GitHubs online Markdown-to-html-API by default (which requires internet connection), but comes with an option for offline conversion (which closely imitates GitHubs behavior), and any other python- or commandline tool can be plugged into it as well. Whatever you use it with is automatically extended with a ton of functionality, like more in- and output options, github-flavored CSS, formula support, advanced image caching and optimization, host-ready file- and image-placement, pdf-conversion, emoji shortcode support, TOC support and more.

Whilst its main purpose is the creation of static pages from markdown files, for example in conjunction with a static website builder or github actions if you host on Github, it can be very well-used for any other purpose.

Here is a (not necessarily extensive) list of its advantages and features:

Advantages & Features :
  • Lets you specify the markdown to convert as a string, as a repository path, as a local file name or as a hyperlink.
  • Pulls any images referenced in the markdown files from the web/ your local storage and places them in a directory relative to your specified website root, so the resulting file structure is host-ready for static sites. Multiple arguments allow the customization of the saving locations, but the images will always be referenced correctly in the resulting html files. This is especially useful since it reflects GitHub's behavior to serve cached copies of README-images instead of linking to them directly, reducing tracking and possibly downscaling overlarge images in the process.
  • Creates all links as root-relative hyperlinks and lets you specify the root directory as well as the locations for css and images, but uses smart standard values for everything.
  • Supports inline LaTeX-formulas (use $-formula-$ to use them), which GitHub usually doesn't. gh-md-to-html uses LaTeX and dvisvgm if they are both installed (advantage: fast, requires no internet), and otherwise the Codecogs EqnEditor (advantage: doesn't require you to install 3 GB of LaTeX libraries) to achieve this.
  • Supports exporting to pdf with or without Github styling, using the pdfkit python module (if it is installed).
  • Tested and optimized to look good when using DarkReader (the .js-module as well as the browser extension). This is especially relevant considering that DarkReader doesn't usually shift the colors of svg images, and the formulas added by gh-md-to-html's formula support are embedded as inline svg. gh-md-to-html ensured that the formulas are the same color as the text, shifted in accordance with DarkReader's current/enabled colorscheme.
  • Supports umlauts and other non-ascii-characters in plain text as well as in multiline code blocks, which the github REST api usually doesn't.
  • Allows you to choose which tool or module to use at its core for the basic markdown to html conversion.
  • Styles its output with github's README-css (can be turned off).
  • Allows you to choose a width for the box surrounding the text; this can increase readability if you intend to host the markdown file stand-alone rather than embedded into a different html file (see #25 and Wikipedia).
  • Comes with an optional support for the use of [[_TOC_]], {:toc} and [toc] at the beginning of an otherwise empty line to create a table of content for the document, like GitLab-flavored markdown does, among others.
  • Comes with an option to compress and downscale all images referenced in the markdown file (does not affect the original images) with a specified background color (default is white) for converting RGBA to RGB, and a specified compression rate (default is 90). Images with a specified width or height attribute in pixels get scaled down to that size to reduce loading time. This helps severely reduce the size of generated pages for markdown files with lots of images. There is also an option to save all images in multiple sizes and let the html viewer/browser pick the one fitting for the viewport size (using the img srcset attribute), thus making gh-md-to-html the only md-to-html converter with builtin srcset support for image load reduction.
  • If two equal images from equal or different sources are referenced in the given markdown file, and both would be saved in the same resolution et cetera, both are pointed to the same copy in the generated html to minimize loading overhead.
  • Comes with an option to closely imitate GitHub's markdown-to-html-conversion behavior offline!
  • Emoji shortcode support.
  • Probably even more than that - this list here is no longer maintained, refer to the documentation further down this README for all options.

In case you are looking for an alternative to Pandoc for converting markdown to PDF, here is a list of reasons why you could want to use gh-md-to-html instead of Pandoc for the job:

Reasons to use this instead of Pandoc

Whilst using pandoc to convert from markdown to pdf usually yields more beautiful results (pandoc uses LaTeX, after all), gh-md-to-html has its own set of advantages when it comes to quickly converting complex files for a homework assignment or other purposes where reliability weights more than beauty:

  • pandoc converts .md to LaTeX and then renders it to pdf, which means that images embedded in the .md are shown where they fit best in the .pdf and not, as one would expect it from a .md-file, exactly where they were embedded.
  • pandoc's pandoc-flavored markdown supports formulas; however, some specific rules apply regarding the amount of whitespace cornering the $-signs and what characters the formula may start with. These rules do not apply in some common markdown editors like MarkText, though, which leads to lots of frustration when formulas that worked in the editor don't work anymore when converting with pandoc (MarkText's own export-to-pdf-function sometimes fails on formula-heavy files without an error message, though, which makes it even less reliable). The worst part is that, whenever pandoc fails converting .md to .pdf because of this, it shows the line number of the error based on the intermediate .tex-file instead of the input .md-file, which makes it difficult to find the problem's root. As you might have guessed, gh-md-to-html couldn't care less about the amount of whitespace you start your formulas with, leaving this decision up to you.
  • pandoc supports multiple markdown flavors. The sole formula-supporting one of these is pandoc-flavored markdown, which comes with some quite specific requirements regarding the amount of trailing whitespace before a sub-list in a nested list, and other requirements to create multi-line bullet point entries. These requirements are not fulfilled my many markdown-editors (such as MarkText) and not required by many other markdown flavors, causing pandoc to not render multiline bullet point entries and nestled lists correctly in many cases. gh-md-to-html, on the other hand, supports both nested lists like you would expect it, and formulas, releasing the burden of having to edit entire markdown files to make then work with pandoc's md-to-html-conversion from your shoulders.

To sum it up, pandoc's md-to-pdf-conversion acts quite unusual when it comes to images, nested lists, multiline bullet point entries, or formulas, and gh-md-to-html does not.

Installation

Use pip3 install gh-md-to-html to install directly from the python package index, or python3 -m pip install gh-md-to-html if you are on Windows.

Both might require sudo on Linux, and you can optionally do

python3 -m pip install gh-md-to-html[pdf_export]

and install wkhtmltopdf (v0.12.6 or greater) to get the optional pdf-conversion feature and convert markdown files to pdf, and/or

python3 -m pip install gh-md-to-html[offline_conversion]

to get the optional offline-conversion feature up and running.

If you are on Windows, you might have to add wkhtmltopdf to your path in your current working directory in order to get pdf conversion to work, e.g. with PATH=%PATH%;c:/program files/wkhtmltopdf/bin or something similar, depending on your installation location.

Usage

If you want to access the interface with your command line, you can just supply gh-md-to-html with the arguments documented in the help text (accessible with gh-md-to-html -h and shown below). On windows, you must supply python3 -m gh_md_to_html with the corresponding arguments.

If you want to access the interface via python, you can use

import gh_md_to_html

and then use gh_md_to_html.main() with the same arguments (and default values) you would supply to the command line interface.

If you only want to imitate the conversion results yield by GitHub's REST API offline, but don't want image caching, formula support and fancy CSS styling, use

html_as_a_string = gh_md_to_html.core_converter.markdown(your_markdown_as_a_string)

in Python.

Documentation

Documentation (throughout introduction for starters - NOT FINISHED YET)
  • Usage: gh-md-to-html

  • Default behavior:
    By default, gh-md-to-html takes a markdown file name as an argument, and saves the generated HTMl in a file of the same name, with .html instead of .md.
    Some quirks:

    • The generated CSS is stored in github-markdown-css/github-css.css (add -c to make it inline instead).
    • All referenced images are cached, stored & referenced in ./images (add -i to disable this).
    • All image & css links assume that you want to host the html file with your current directory as the root directory (add -w if you want to directly view it in a browser instead).
    • All ids and file-internal links are prefaced by user-content-, so you can embed the generated html in a bigger website without risking ID clashes.
  • Some common use cases:
    Through past issues, I realised that there are some very common use cases that most people seem to have for this module. Here are the most common ones, and which options and arguments to use for them:

    • preview a GitHub README: use -i -w --math false --box-width 25cm, though grip might be more efficient for this purpose.
    • preview a GitLab README: see above, and add --toc to support GitLab's TOC syntax.
    • as an alternative to pandoc-flavored markdown: use --math true --emoji-support 0 --dont-make-images-links true.
    • having everything in one file: use -i -c to have everything in one file.
  • Converting markdown files from the web with --origin-type:
    You might want to not only convert a local markdown file, but also a file from a GitHub repository, a web-hosted one, or the contents of a string. Simply downloading these or storing them in a file is often not enough, since their location on the web also influences how the links to images they reference must be resolved. Luckily, gh-md-to-html has got your back!
    There is a number of different arguments you can use to describe what kind of file the input you gave references:

    • --origin-type file: The default; takes a (relative or absolute) file path
    • --origin-type repo: Takes a pth to a markdown file in a github repository, in the format / / / .md .
    • --origin-type web: Takes the url of a web-hosted markdown file.
    • --origin-type string: Takes a string containing markdown. Some of these options you use influences how image links within the markdown file are resolved; a later section of this README outlines this in detail.
  • Fine-tuning what goes where:
    gh-md-to-html is written with the goal of generating a host-ready static website for you, with your current working directory as its root. Aside from using -w to disable this and allow you to view the generated file directly in a browser, there are a number of options that allow you to fine-tune what goes where, and most popularly, change the root of the website. There is no need to do so unless you want to for some reason, so don't bother reading this if you don't need to!

    • --website-root(or -w): Leaving this option empty, as discussed above, allows you to preview the generated html file directly in a browser (on most systems by double-clicking it) in case you don't want to host the generated html file, but you can also supply any directory that you want to use as the website's root to this. It defaults to your current working directory.
    • --destination (or -d): The path, relative to --website-root, in which the generated html file is stored. By default, the website root is used for this.
    • --image-paths (or -i): You can leave this empty to disable image caching, as described above (though this won't work in case you modified --origin-type), or supply a path relative to website-root to modify where images are stored. It defaults to images.
      Image caching makes sure that two pixel-identical images are stored in the same file location, to minimize loading time for files with multiple identical images. The image-paths-directory isn't automatically emptied between multiple runs of gh-md-to-html for this reason, to ensure that this optimization can be used cross-file when converting multiple files in a bulk.
    • --css-paths (or -c): You can leave this empty to disable storing the CSS in an external CSS file (useful e.g. if you want to convert only one file), as described above, or supply a path relative to website-root to modify where the CSS file (called github-css.css) will be stored. The default is github-markdown-css.
    • --output-name (or -n): The file name under which to store the generated html file in the destination-directory. You can use anywhere in this string, and it will automatically be replaced with the name of the markdown file, so, for example, gh-md-to-html inp.md -n " -conv.html" will store the result in ino-conv.html (this doesn't work with --origin-type string, of course).
      You can also use -n print in order to simply write the output to STDOUT (print it on the console) instead of saving it anywhere. The default value is .html , so it adapts to your input file name.
    • --output-pdf (or -p): The file in which to store the generated pdf. You can use the -syntax here as well. If the -p-option isn't used, no pdf will be generated (and you need to have followed the pdfkit & wkhtmltopdf installation instructions above to have this option work), but you can use -p without any arguments to have it use .pdf as a sensitive file name default.
  • exporting as pdf:
    As mentioned above, you can export the generated HTML file as a pdf using the --output-pdf-option. Doing so requires you to have wkhtmltopdf installed (the Qt-patched version), to add it to the PATH (if you are on Windows), and to have pdfkit installed (e.g. via pip3 install gh-md-to-html[offline_conversion]), but all of these requirements are already outlined above in the installation section.
    There are some things worth noting here, though. First of all, DO NOT use this option if you have valuable information in a file called {yourpdfexportdestination}.html, where {yourpdfexportdestination} is what you supplied to -p, since this file will be temporarily overwritten in the process; furthermore, do not use -p at all if you are supplying untrusted input to the -x-option.
    There are also some options specifically tailored for use with -p; these are currently:

    • --style-pdf (or -s): Set this to false to disable styling the generated PDF file with GitHub's CSS. You might want to do this because the border that GitHub's CSS draws around the page can look counterintuitive in PDFs, though doing so can also negatively influence the appearance of other parts, so use this with a grain of salt.
  • changing which core markdown converter to use:
    gh-md-to-html doesn't actually do all that much heavy lifting itself when it comes to parsing markdown and converting it to PDF; instead, it wraps around a so-called "core converter" that does the basic conversion according to the markdown spec, and builds its own options, features, customizations and styling on top of that. By default, the GitHub markdown REST API is used for that, since it comes closest to what GitHub does with its READMEs, but you can also give gh-md-to-html any other basic markdown converter to work with.

    gh-md-to-html also comes with two build-in alternative core converters to use, that imitate GitHub's REST API as close as possible whilst adding their own personal touch to it.

    Option to decide the core converter:

    • --core-converter (or -o): You can use this option to choose from a number of pre-defined core converters (see below) in case you want to differ from the default one.

      You can also supply a bash command (on UNIX/Linux systems) to this, or a cmd.exe command on Windows, in which {md} stands as a placeholder for where the shell-escaped input markdown will be inserted by gh-md-to-html. For example,
      gh-md-to-html inp.md -o "pandoc -f markdown -t html <<< {md}"
      will use pandoc as its core converter.
      You can also do so using multiple commands, like
      gh-md-to-html -o "printf {md} >> temp.md; pandoc -f markdown -t html temp.md; rm temp.md",
      as long as the result is printed to stdout.

      If you use the Python-interface to gh-md-to-html, you can also supply any function that converts a markdown string into a html string to this argument.

    Pre-defined core converters that you can easily supply to --core-converter as strings:

    • OFFLINE: Imitates GitHub's markdown REST API, but offline using mistune. This requires the optional dependencies for "offline_conversion" to be satisfied, by using pip3 install gh-md-to-html[offline_conversion] or pip3 install mistune>=2.0.0rc1.
    • OFFLINE+: Behaves identical to OFFLINE, but it doesn't remove potentially harmful content like javascript and css like the GitHub REST API usually does. DO NOT USE THIS FEATURE unless you need a way to convert secure manually-checked markdown files without having all your inline js/styling stripped away!
  • support for inline-formulas:
    gh-md-to-html supports, by default, inline formulas (no matter which core converter, see above, you use). This means that you can write a LaTeX formula between two dollar signs on the same line, and it will be replaced with an SVG image displaying said formula. For example,
    $e = m \cdot c^2$
    will add Einstein's famous formula as a svg image, well-aligned with the rest of the text surrounding it, into your document.

    gh-md-to-html always tries to use your local LaTeX installation to do this conversion (advantage: fast and doesn't require internet). However, if LaTeX or dvisvgm are not installed or it can't find them, it uses an online converter (advantage: doesn't require you to install 3 GB of LaTeX libraries) to achieve this.

    You can use the following options to modify this behavior:

    • --math (or -m): Set this to false to disable formula rendering.
    • --suppress-online-fallbacks: Set this to true to disable the online fallback for formula rendering, raising an error if its requirements aren't locally installed or can't be found for some reason.
  • image caching and image compression:
    As explained in-depth above, gh-md-to-html saves images so they can all be loaden from the same folder. This comes with the advantages of

    • potentially reducing tracking (in case the images where hosted on a 3rd-party website)
    • reducing the number of DNS lookups required to show your generated HTMl file (in case the images where hosted on different 3rd-party websites)
    • reducing the number of images to load (if one or multiple md files you intend to host or view as html files contain the same or pixel-identical images)

    In addition to these advantages, gh-md-to-html also allows you to set a level of image compression to use for these images. If you decide to do so, every image will be converted to JPEG (using a background color and quality settings of your liking), and images will be downscaled if the generated html states that they won't be needed at their full size anyways (you can make use of this e.g. by using -tags directly in your document and supplying them with an explicit width or height value).

    gh-md-to-html is also the only markdown converter capable of making use of the html srcset-attribute, which allows the generated document to reference several differently scaled versions of the same image, of whom the browser will then load the smallest large-enough one on smaller screen sizes, leading to great load reductions e.g. on mobile. Enabling this feature can lead to further loading time reductions without sacrificing any visible image quality, which makes gh-md-to-html the best choice if you want to generate fast-loading websites from your image-heavy markdown files.

    The option to use for all of this is

    • --compress-images.
      and it accepts a piece of JSON data with the following attributes:

      • bg-color: the color to use as a background color when converting RGBA-images to jpeg (an RGB-format). Defaults to "white" and accepts almost any HTML5 color-value ("#FFFFFF", "#ffffff", "white" and "rgb(255, 255, 255)" would've all been valid values).
      • progressive: Save images as progressive jpegs. Default is False.
      • srcset: Save differently scaled versions of the image and provide them to the image in its srcset attribute. Defaults to False. Takes an array of different widths or True, which serves as a shortcut for "[500, 800, 1200, 1500, 1800, 2000]".
      • quality: a value from 0 to 100 describing at which quality the images should be saved. Defaults to 90. If a specific size is specified for a specific image in the html, the image is always converted to the right size before reducing the quality.

      If this argument is left empty, no compression is used at all. If this argument is set to True, all default values are used. If it is set to json data and some values are omitted, the defaults ones are used for these.

      You can also pass a dict instead of a string containing JSON data if you are using this option in the Python frontend.

      Image compression won't work, for obvious reasons, if you use -i to disable image caching.

  • my personal choices:
    GitHub-flavored markdown and markdown in general makes some unpopular choices, and gh-md-to-html, imitating it, also makes a lot of these. If your goal isn't to be as close as possible to (github-flavored) markdown, and you want to utilize the full power that gh-md-to-html offers to the fullest, I recommend the following (very opinionated) list of settings and options. Note that some of these aren't safe when converting user-generated content, though.

    • --math true: This is already enabled by default, so not really a recommendation, but you'll most likely want to have LaTeX math support in your file.
    • --core-converter OFFLINE+: This converts the markdown files offline instead of using GitHub's REST API, and allows the use of unsafe things like inline code and every html you could wish for in your markdown file.
    • --compress-images: There are many ways to finetune this options, but it allows for some great optimizations on the cached images, including the use of the HTML srcset-attribute, which no other markdown converter currently supports afaik.
    • --box-width 25cm: You'll most likely want to limit the width of the box in which the generated website's content is displayed for reasons of readability, unless you plan to embed the generated html into a bigger html file.
    • --toc true: This allows you to use [[_TOC_]] as a shortcut for a table of contents in the generated file.
    • --dont-make-images-links true: By default, GitHub wraps every image into a link to the image source, unless the image is already wrapped into a different link. This option disables this behavior for more control over your image's links.
    • --emoji-support 2: gh-md-to-html supports using emoji shortcodes, like :joy:, which are then replaced with emojis in the generated html file. --emoji-support 2 takes this one level further this by allowing you to use your own custom emojis, so :path/to/funny_image.png: will add funny_image.png as an emoji-sized emoji into the text.
    • --soft-wrap-in-code-boxes true: By default, GitHub displays its multiline code boxes with a horizontal scrollbar if they are at a risk of overflowing. Use this option to have (imho more reasonable) soft-wrap in code boxes instead.
Help text (look up what every option does) All arguments and how they work are documented in the help text of the program, which looks like the following.

Please note that the options are listed ordered by relevance, and all of them have sensible defaults, so don't feel overwhelmed by how many there are; you can just read through them until you find what you where looking for, and safely ignore the rest.
Most of the options are meant to customize default behavior, so none of them are mandatory for most use cases.

/github-markdown-css"-folder. -n OUTPUT_NAME [OUTPUT_NAME ...], --output-name OUTPUT_NAME [OUTPUT_NAME ...] What the generated html file should be called like. Use within the value to refer to the name of the markdown file that is being converted (if you don't use "-t string"). You can use '-n print' to print the file (if using the command line interface) or return it (if using the python module), both without saving it. Default is ' .html'. -p OUTPUT_PDF [OUTPUT_PDF ...], --output-pdf OUTPUT_PDF [OUTPUT_PDF ...] If set, the file will also be saved as a pdf file in the same directory as the html file, using pdfkit, a python library which will also need to be installed for this to work. You may use the variable in this value like you did in --output-name. Do not use this with the -c option if the input of the -c option is not trusted; execution of malicious code might be the consequence otherwise!! -s STYLE_PDF, --style-pdf STYLE_PDF If set to false, the generated pdf (only relevant if you use --output-pdf) will not be styled using github's css. -f FOOTER [FOOTER ...], --footer FOOTER [FOOTER ...] An optional piece of html which will be included as a footer where the 'hosted with <3 by github'-footer in a gist usually is. Defaults to None, meaning that the section usually containing said footer will be omitted altogether. -m MATH, --math MATH If set to True, which is the default, LaTeX-formulas using $formula$-notation will be rendered. -x EXTRA_CSS [EXTRA_CSS ...], --extra-css EXTRA_CSS [EXTRA_CSS ...] A path to a file containing additional css to embed into the final html, as an absolute path or relative to the working directory. This file should contain css between two
Comments
  • Problems with OFFLINE+ conversion (mistune)

    Problems with OFFLINE+ conversion (mistune)

    Hi,

    Thanks for creating this great package! I like it really much, and I would prefer myself to have fully offline conversion (and not send my data to GitHub). I tried the core_converter="OFFLINE+", but it throws some errors. I am using gh-md-to-html version 1.7.0.

    (proj) PS C:\cases\myproj> python .\report\create_report.py
    Warning: libgs not found
    Traceback (most recent call last):
      File "C:\cases\myproj\report\create_report.py", line 12, in <module>
        gh_md_to_html.main(inputfile, website_root='.', output_name=outputfile, core_converter='OFFLINE+')
      File "C:\Users\niko\venvs\proj\lib\site-packages\gh_md_to_html\__main__.py", line 502, in main
        from . import core_converter as cc
      File "C:\Users\niko\venvs\proj\lib\site-packages\gh_md_to_html\core_converter.py", line 1, in <module>
        import mistune
    ModuleNotFoundError: No module named 'mistune'
    (proj) PS C:\cases\myproj> pip install mistune
    Collecting mistune
      Using cached mistune-0.8.4-py2.py3-none-any.whl (16 kB)
    Installing collected packages: mistune
    Successfully installed mistune-0.8.4
    WARNING: You are using pip version 20.2.3; however, version 21.0.1 is available.
    You should consider upgrading via the 'c:\users\niko\venvs\proj\scripts\python.exe -m pip install --upgrade pip' command.
    (proj) PS C:\cases\myproj> python .\report\create_report.py
    Warning: libgs not found
    Traceback (most recent call last):
      File "C:\cases\myproj\report\create_report.py", line 12, in <module>
        gh_md_to_html.main(inputfile, website_root='.', output_name=outputfile, core_converter='OFFLINE+')
      File "C:\Users\niko\venvs\proj\lib\site-packages\gh_md_to_html\__main__.py", line 502, in main
        from . import core_converter as cc
      File "C:\Users\niko\venvs\proj\lib\site-packages\gh_md_to_html\core_converter.py", line 6, in <module>
        from mistune.scanner import escape_html
    ModuleNotFoundError: No module named 'mistune.scanner'; 'mistune' is not a package
    

    It seems that the problem is solved by using the v2 mistune release candidate (pip install mistune==2.0.0rc1), which is not installed automatically by pip yet. Maybe it would be worth mentioning in the REAME? Anyway, just wanted to leave this here in case anyone else faces the same problem.

    bug - installation 
    opened by np-8 10
  • Error running the command, related to latex2svg.py

    Error running the command, related to latex2svg.py

    Hi, thanks for sharing this software!

    However, I'm not able to run it, even running just gh-md-to-html or gh-md-to-html -d gives an error. I'm using the version gh-md-to-html-1.11.6 and Python 3.9.2 on Debian Bullseye.

    Traceback (most recent call last):
      File "/home/jj/.local/lib/python3.9/site-packages/gh_md_to_html/latex2svg.py", line 101, in latex2svg
        ret.check_returncode()
      File "/usr/lib/python3.9/subprocess.py", line 460, in check_returncode
        raise CalledProcessError(self.returncode, self.args, self.stdout,
    subprocess.CalledProcessError: Command '['latex', '-interaction', 'nonstopmode', '-halt-on-error', 'code.tex']' returned non-zero exit status 1.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
        mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
      File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details
        return _get_module_details(pkg_main_name, error)
      File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details
        __import__(pkg_name)
      File "/home/jj/.local/lib/python3.9/site-packages/gh_md_to_html/__init__.py", line 1, in <module>
        from .__main__ import *
      File "/home/jj/.local/lib/python3.9/site-packages/gh_md_to_html/__main__.py", line 247, in <module>
        raw_formula2svg_offline("w")
      File "/home/jj/.local/lib/python3.9/site-packages/gh_md_to_html/__main__.py", line 236, in raw_formula2svg_offline
        return latex2svg(formula)["svg"]
      File "/home/jj/.local/lib/python3.9/site-packages/gh_md_to_html/latex2svg.py", line 84, in latex2svg
        return latex2svg(code, params, working_directory=tmpdir)
      File "/home/jj/.local/lib/python3.9/site-packages/gh_md_to_html/latex2svg.py", line 103, in latex2svg
        raise Exception("LaTeX failed with error:", str(ret.stderr, encoding="UTF-8"),
    Exception: ('LaTeX failed with error:', '', '\nThis happened whilst rendering formula $w$.')
    
    bug - error 
    opened by jjnilton 8
  • table of contents `[[_TOC_]]` not available in HTML

    table of contents `[[_TOC_]]` not available in HTML

    When I have a table of contents (via the [[_TOC_]] keyword) in my markdown, the HTML will not show a table of contents but simply these few characters [[TOC]]. Is this a bug or simply a too "complicated" feature which will not be available?

    bug - output 
    opened by fabbra 8
  • Output html page width

    Output html page width

    Just an idea: Would it be nice to have an option for having some maximum page width for the output html? I mean, now it is possible through by adding extra css:

    // extra.html
    <style>
    	div.gist-file {
    		max-width: 800px;
    		margin: 0 auto;
    	}
    </style>
    

    and

    gh_md_to_html.main(
        inputfile,
        extra_css="extra.html",
    )
    

    I guess this is something people would like to have very commonly. As this package aims to remove the hassle (with alternatives like pandoc), there could be a reasonable default page width. The default (max) page width could be or example 800px and it could be always centered. I'm thinking something like this

    gh_md_to_html.main(
        inputfile,
        extra_css="extra.html",
        page_width=900,
    )
    

    to control the page width and page_width=None would remove max width altogether.

    enhancement ToDo 
    opened by np-8 8
  • libgs on windows

    libgs on windows

    libgs is requred for latex2svg feature in the project. I'm unable to make libgs work on windows10 neither with 3.8 nor 3.9 python.

    PS D:\dev\xxx\documentGenerator>  .\venv\Scripts\python.exe -m pip install libgs
    Collecting libgs
      Using cached libgs-1.2.1.tar.gz (123 kB)
    Collecting libgs_ops
      Using cached libgs_ops-1.1.tar.gz (56 kB)
    Collecting pandas==0.21.0
      Using cached pandas-0.21.0.tar.gz (11.3 MB)
      Installing build dependencies ... |
    ...
    building with VS2019 
    ...
    WARNING: Discarding https://files.pythonhosted.org/packages/84/4c/622301f99725c6da76ae8079cb6b9091d9098098bd6b4eac47fb502b32f4/pandas-0.21.0.tar.gz#sha256=5cd5cb30e72eeaf202f0e5e180780b897570e889d2db328c689a5a263405c559 (from https://pypi.org/simple/pandas/). Command errored out with exit status 1: 'D:\dev\xxx\documentGenerator\venv\Scripts\python.exe' 'D:\dev\xxx\documentGenerator\venv\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\arhimed\AppData\Local\Temp\pip-build-env-bf3xyk8l\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- wheel setuptools Cython 'numpy==1.9.3; python_version=='"'"'3.5'"'"'' 'numpy==1.12.1; python_version=='"'"'3.6'"'"'' 'numpy==1.13.1; python_version>='"'"'3.7'"'"'' Check the logs for full command output.
    Collecting libgs
      Using cached libgs-1.1.tar.gz (270 kB)
      Using cached libgs-0.11.tar.gz (272 kB)
    ERROR: Cannot install libgs==0.11, libgs==1.1 and libgs==1.2.1 because these package versions have conflicting dependencies.
    
    The conflict is caused by:
        libgs 1.2.1 depends on pandas==0.21.0
        libgs 1.1 depends on pandas==0.21.0
        libgs 0.11 depends on pandas==0.21.0
    
    To fix this you could try to:
    1. loosen the range of package versions you've specified
    2. remove package versions to allow pip attempt to solve the dependency conflict
    
    ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
    PS D:\dev\xxx\documentGenerator>
    

    With python 3.6 I can make libgs compile and install but project complain libgs is not found?!

    PS D:\dev\xxx\documentGenerator> .\venv\Scripts\python.exe -m pip install libgs
    Requirement already satisfied: libgs in d:\dev\xxx\documentgenerator\venv\lib\site-packages (1.2.1)
    Requirement already satisfied: libgs_ops in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (1.1)
    Requirement already satisfied: pandas==0.21.0 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (0.21.0)
    Requirement already satisfied: numpy==1.13.3 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (1.13.3)
    Requirement already satisfied: ephem==3.7.6.0 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (3.7.6.0)
    Requirement already satisfied: tornado<5 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (4.5.3)
    Requirement already satisfied: bokeh==0.12.6 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (0.12.6)
    Requirement already satisfied: Flask==0.12.2 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (0.12.2)
    Requirement already satisfied: angles==2.0 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (2.0)
    Requirement already satisfied: pyzmq==16.0.2 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (16.0.2)
    Requirement already satisfied: SQLAlchemy>1.2 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (1.3.23)
    Requirement already satisfied: xmltodict in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (0.12.0)
    Requirement already satisfied: lxml in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (4.6.2)
    Requirement already satisfied: pymysql in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (1.0.2)
    Requirement already satisfied: pyserial in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from libgs) (3.5)
    Requirement already satisfied: six>=1.5.2 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from bokeh==0.12.6->libgs) (1.15.0)
    Requirement already satisfied: requests>=1.2.3 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from bokeh==0.12.6->libgs) (2.25.1)
    Requirement already satisfied: PyYAML>=3.10 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from bokeh==0.12.6->libgs) (5.4.1)
    Requirement already satisfied: python-dateutil>=2.1 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from bokeh==0.12.6->libgs) (2.8.1)
    Requirement already satisfied: Jinja2>=2.7 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from bokeh==0.12.6->libgs) (2.11.3)
    Requirement already satisfied: bkcharts>=0.2 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from bokeh==0.12.6->libgs) (0.2)
    Requirement already satisfied: Werkzeug>=0.7 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from Flask==0.12.2->libgs) (1.0.1)
    Requirement already satisfied: click>=2.0 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from Flask==0.12.2->libgs) (7.1.2)
    Requirement already satisfied: itsdangerous>=0.21 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from Flask==0.12.2->libgs) (1.1.0)
    Requirement already satisfied: pytz>=2011k in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from pandas==0.21.0->libgs) (2021.1)
    Requirement already satisfied: MarkupSafe>=0.23 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from Jinja2>=2.7->bokeh==0.12.6->libgs) (1.1.1)
    Requirement already satisfied: urllib3<1.27,>=1.21.1 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from requests>=1.2.3->bokeh==0.12.6->libgs) (1.26.3)
    Requirement already satisfied: certifi>=2017.4.17 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from requests>=1.2.3->bokeh==0.12.6->libgs) (2020.12.5)
    Requirement already satisfied: idna<3,>=2.5 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from requests>=1.2.3->bokeh==0.12.6->libgs) (2.10)
    Requirement already satisfied: chardet<5,>=3.0.2 in d:\dev\xxx\documentgenerator\venv\lib\site-packages (from requests>=1.2.3->bokeh==0.12.6->libgs) (4.0.0)
    PS D:\dev\xxx\documentGenerator>
    PS D:\dev\xxx\documentGenerator>
    PS D:\dev\xxx\documentGenerator> .\venv\Scripts\python.exe -m gh_md_to_html -h
    Warning: libgs not found
    

    thanks

    bug - installation ToDo 
    opened by arhi 7
  • Problem with long image file name

    Problem with long image file name

    The following Markdown file

    # Test
    
    ![OK](https://img.shields.io/badge/-Python-black?style=flat-square&logo=Python)
    
    ![NOK](https://img.shields.io/badge/-Python-black?style=flat-square&logo=Python&logocolor=yellow&logowidth=40&link=https://www.python.org/doc/)
    

    fails in WSL with the error:

    OSError: [Errno 36] File name too long: 'images/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d507974686f6e2d626c61636b3f7374796c653d666c61742d737175617265266c6f676f3d507974686f6e266c6f676f636f6c6f723d79656c6c6f77266c6f676f77696474683d3430266c696e6b3d68747470733a2f2f7777772e707974686f6e2e6f72672f646f632f.svg'

    Reason

    This can be reproduced for any image with sufficiently long file name, and for badges from shields.io with a long list of parameters, which result in a file name that encodes these parameters in ascii.

    The bug appears to be due to the maximum path length limitation of 260 characters in Windows. Presumably this would also happen in plain Windows and not just WSL, but I could not reproduce due to a different error (UnicodeEncodeError).

    Workaround

    The problem can be circumvented by running gh_md_to_html test.md -i (deliberately leaving the optional argument to -i empty to not download images), but this is not ideal.

    Solution

    See this commit in httpie for a possible workaround.

    bug - error fixed 
    opened by janniklasrose 6
  • Syntax [![](image_location)](link_target) for making image links?

    Syntax [![](image_location)](link_target) for making image links?

    This is quite simple thing. There are few ways to make images work as links. Two of the following syntaxes do work (gh-md-to-html v. 1.7.0), but the last one, which is in my opinion the prettiest, as it is the least verbose, does not.

    Is there a reason this syntax does not work, and could that syntax be supported in the future? I'm using the OFFLINE+ core_converter.

    Test markdown code

    Works 
    
    <a href="images/test.png">![](images/test.png)</a>
    
    Also works
    
    [<img src="images/test.png">](images/test.png)
    
    Does not work
    
    [![](images/test.png)](images/test.png)
    
    bug - output fixed 
    opened by np-8 5
  • links to anchors to other headings not working

    links to anchors to other headings not working

    I have a markdown file with various headings and links inside the same file linking to those headings (i.e., linking to anchors in the same file) and converted this to HTML using the following code:

      gh-md-to-html ./test.md -w .
    

    After conversion the "internal" links to other headings do not work anymore. My dirty workaround was to replace id="user-content- with id=" and class="anchor" with an empty string.

      sed -i 's/id=\"user-content-/id=\"/g' test.html
      sed -i 's/class=\"anchor\" //g' test.html
    

    I suppose there might be a more elegant solution to this?

    bug - output 
    opened by fabbra 4
  • Choose faster hash than MD5

    Choose faster hash than MD5

    gh-md-to-html currently uses MD5 to ensure no two identical images are saved in different locations, which is pretty slow. A faster hash algorithm might work wonders, especially since all we need is collision security and nothing more.

    fixed performance 
    opened by phseiff 4
  • encoding error

    encoding error

    when i use it to convert a markdown file, which contains some Chinese words, the following error was shown:

    Traceback (most recent call last):
      File "MarkdownToHtml.py", line 14, in <module>
        f.write(gh_md_to_html.main(md_file))
      File "/home/rvbust/.local/lib/python3.7/site-packages/gh_md_to_html/__init__.py", line 834, in main
        html_content = core_converter(md_content)
      File "/home/rvbust/.local/lib/python3.7/site-packages/gh_md_to_html/__init__.py", line 476, in markdown_to_html_via_github_api
        requests.post("https://api.github.com/markdown/raw", headers=headers, data=markdown).content,
      File "/home/rvbust/.local/lib/python3.7/site-packages/requests/api.py", line 117, in post
        return request('post', url, data=data, json=json, **kwargs)
      File "/home/rvbust/.local/lib/python3.7/site-packages/requests/api.py", line 61, in request
        return session.request(method=method, url=url, **kwargs)
      File "/home/rvbust/.local/lib/python3.7/site-packages/requests/sessions.py", line 542, in request
        resp = self.send(prep, **send_kwargs)
      File "/home/rvbust/.local/lib/python3.7/site-packages/requests/sessions.py", line 655, in send
        r = adapter.send(request, **kwargs)
      File "/home/rvbust/.local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
        timeout=timeout
      File "/home/rvbust/.local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 706, in urlopen
        chunked=chunked,
      File "/home/rvbust/.local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 394, in _make_request
        conn.request(method, url, **httplib_request_kw)
      File "/home/rvbust/.local/lib/python3.7/site-packages/urllib3/connection.py", line 234, in request
        super(HTTPConnection, self).request(method, url, body=body, headers=headers)
      File "/usr/lib/python3.7/http/client.py", line 1260, in request
        self._send_request(method, url, body, headers, encode_chunked)
      File "/usr/lib/python3.7/http/client.py", line 1305, in _send_request
        body = _encode(body, 'body')
      File "/usr/lib/python3.7/http/client.py", line 174, in _encode
        (name.title(), data[err.start:err.end], name)) from None
    UnicodeEncodeError: 'latin-1' codec can't encode characters in position 3-4: Body ('安装') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.
    
    

    the markdown file is very simple:

    ## 安装
    
    查看 [安装指导](./static/InstallGuide.html)
    
    opened by xiaodaxia-2008 3
  • Allow the use of an online fallback for html-to-pdf-conversion.

    Allow the use of an online fallback for html-to-pdf-conversion.

    As it is now, the README doesn't contain instructions on how to set up pdf conversion on Windows, since wkhtmltopdf is different to set up on Windows than it is on Linux.

    To fix this, I could either

    • add an explanation to the README how wkhtmltopdf can be installed on Windows, and raise an error if it isn't present with a link to the installation instructions (my preferred method)
    • make gh-md-to-html use an online converter for this if wkhtmltopdf is unavailable. This is potentially risqué, though, since it means the whole file (and not just formulas) gets send to an online service (see #32 ) in case the dependencies aren't properly installed. This solution probably adds more value than the first solution, but it is more difficult to implement, so I will probably go with the first one and think about the second one if someone asks for it/ suggests it.

    I will probably go with a mixture of both solutions in the end by implementing the first one, and then potentially adding the second one additionally.

    enhancement wontfix fixed 
    opened by phseiff 3
  • Tables not rendering

    Tables not rendering

    Hi, I could not find any info on this, but simple markdown tables like | cell 1 | cell 2 | | cell 3 | cell 4 | are not being rendered as table in html/pdf. Is this a bug, or a missing feature?

    opened by bob-robster 0
  • Problem with module emoji

    Problem with module emoji

    With emoji python3 module version >= 2.0.0 I get the following error

    Traceback (most recent call last):
      File "/usr/lib64/python3.9/runpy.py", line 197, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/home/marbangens/.local/lib/python3.9/site-packages/gh_md_to_html/__main__.py", line 5, in <module>
        cmd_to_main()
      File "/home/marbangens/.local/lib/python3.9/site-packages/gh_md_to_html/__init__.py", line 1618, in cmd_to_main
        result = main(**vars(parser.parse_args()))
      File "/home/marbangens/.local/lib/python3.9/site-packages/gh_md_to_html/__init__.py", line 903, in main
        html_content = find_and_render_formulas_in_html(html_content, formula_mapper, special_chars_in_code_blocks,
      File "/home/marbangens/.local/lib/python3.9/site-packages/gh_md_to_html/__init__.py", line 451, in find_and_render_formulas_in_html
        shortcode_to_emoji(emoji_shortcode, emoji_support)
      File "/home/marbangens/.local/lib/python3.9/site-packages/gh_md_to_html/__init__.py", line 97, in shortcode_to_emoji
        if shortcode not in emoji.EMOJI_ALIAS_UNICODE_ENGLISH:
    

    Quick fix:

    pip uninstall emoji

    pip install emoji==1.7.0

    opened by noisecode3 0
  • Suggestions for ouliner in markdown to html

    Suggestions for ouliner in markdown to html

    Hi, so glad to find this project! I use Dynalist.io/ quite a bit and used to use Fargo and Workflowy (or LoqSeq). I want this same functionality in my own static website (the reader part). I see you use a Details HTML Element in the readme for the collapsed text section. I've been looking at ways to integrate this with markdown (link below). Do you have any suggestions?

    Somehow the converter needs to translate Markdown nested lists (with maybe a + to designate the open state) into HTML Details with Blockquote. Most converters (https://markdowntohtml.com/) convert to nesting of HTML lists.

    I read your note about Pandoc lists but need to look more closely at the hangups it has.

    https://gist.github.com/pierrejoubert73/902cc94d79424356a8d20be2b382e1ab?permalink_comment_id=4320038#gistcomment-4320038

    opened by auwsom 1
  • The system cannot find the file specified. on Windows

    The system cannot find the file specified. on Windows

    So I pip installed this and have been trying to convert a .md to pdf. On windows, FYI.

    python3 -m pip install gh-md-to-html[pdf_export] python3 -m pip install gh-md-to-html[offline_conversion] I then grabbed the latest wkhtmltopdf for windows 64bit and added C:\Program Files\wkhtmltopdf\bin to PATH.

    From CLI, I've tried every flavor possible for specifying this file, and each time get The system cannot find the file specified. with no recognition of which file path it's referring to.

    cd C:\absolute\path

    gh-md-to-html file.md -p <name>.pdf gh-md-to-html "C:\\absolute\\path\\file.md" -p <name>.pdf gh-md-to-html "C:\absolute\path\file.md" -p <name>.pdf gh-md-to-html "C:/absolute/path/file.md" -p <name>.pdf gh-md-to-html "./file.md" -p <name>.pdf

    I then tried it from Python, with cwd as C:\absolute\path

    import gh_md_to_html
    gh_md_to_html.main('file.md',output_pdf='file.pdf')
    

    It creates an images and github-markdown-css folder and populates them, then a stacktrace of the same error:

    ---------------------------------------------------------------------------
    FileNotFoundError                         Traceback (most recent call last)
    ~\AppData\Local\Temp/ipykernel_23632/3088507330.py in <module>
    ----> 1 gh_md_to_html.main('comments.md',output_pdf='comments.pdf')
    
    c:\Users\seanm\Anaconda3\envs\raz\lib\site-packages\gh_md_to_html\__init__.py in main(md_origin, origin_type, website_root, destination, image_paths, css_paths, output_name, output_pdf, style_pdf, footer, math, formulas_supporting_darkreader, extra_css, core_converter, compress_images, enable_image_downloading, box_width, toc, dont_make_images_links, soft_wrap_in_code_boxes, suppress_online_fallbacks, validate_html, emoji_support, enable_css_saving)
       1319 
       1320         # check which version of wkhtmltopdf we have installed
    -> 1321         version_str = str(subprocess.check_output(["wkhtmltopdf", "-V"]), encoding="UTF-8").strip()
       1322         if version_str.startswith("wkhtmltopdf "):
       1323             version_str = version_str.split(" ", 1)[1]
    
    c:\Users\seanm\Anaconda3\envs\raz\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs)
        422         kwargs['input'] = empty
        423 
    --> 424     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        425                **kwargs).stdout
        426 
    
    c:\Users\seanm\Anaconda3\envs\raz\lib\subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)
        503         kwargs['stderr'] = PIPE
        504 
    --> 505     with Popen(*popenargs, **kwargs) as process:
        506         try:
        507             stdout, stderr = process.communicate(input, timeout=timeout)
    
    c:\Users\seanm\Anaconda3\envs\raz\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask)
        949                             encoding=encoding, errors=errors)
        950 
    --> 951             self._execute_child(args, executable, preexec_fn, close_fds,
        952                                 pass_fds, cwd, env,
        953                                 startupinfo, creationflags, shell,
    
    c:\Users\seanm\Anaconda3\envs\raz\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session)
       1418             # Start the process
       1419             try:
    -> 1420                 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
       1421                                          # no special security
       1422                                          None, None,
    
    FileNotFoundError: [WinError 2] The system cannot find the file specified
    

    This suggests to me that it's not finding wkhtmltopdf or something, even though I added it to PATH. Have you noticed anything like this before?

    I am able to get it into an HTML with gh_md_to_html.main('file.md',destination='file.html'), and it copies over the images to a new folder, however they don't appear in the HTML doc. A single file PDF is definitely preferable for me though. I like writing documentation in VSCode in MD, and literally just want to be able to send docs to my colleagues who don't know what a markdown is.

    opened by openSourcerer9000 0
  • XMLParsedAsHTMLWarning blocks the usage of gh-md-to-html

    XMLParsedAsHTMLWarning blocks the usage of gh-md-to-html

    I've just discovered this tool and I need it to get my school notes up and running, but I've run into an error which I can't make sense of. This dump appears every time I try to use gh-md-to-html on a file :

    /home/rigobert9/.local/lib/python3.10/site-packages/bs4/builder/__init__.py:545: XMLParsedAsHTMLWarning: It looks like you're parsing an XML document using an HTML parser. If this really is an HTML document (maybe it's XHTML?), you can ignore or filter this warning. If it's XML, you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the lxml package installed, and pass the keyword argument `features="xml"` into the BeautifulSoup constructor.
      warnings.warn(
    Traceback (most recent call last):
      File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "/home/rigobert9/.local/lib/python3.10/site-packages/gh_md_to_html/__main__.py", line 5, in <module>
        cmd_to_main()
      File "/home/rigobert9/.local/lib/python3.10/site-packages/gh_md_to_html/__init__.py", line 1618, in cmd_to_main
        result = main(**vars(parser.parse_args()))
      File "/home/rigobert9/.local/lib/python3.10/site-packages/gh_md_to_html/__init__.py", line 903, in main
        html_content = find_and_render_formulas_in_html(html_content, formula_mapper, special_chars_in_code_blocks,
      File "/home/rigobert9/.local/lib/python3.10/site-packages/gh_md_to_html/__init__.py", line 431, in find_and_render_formulas_in_html
        formula_rendered = formula2svg(formula, amount_of_svg_formulas)
      File "/home/rigobert9/.local/lib/python3.10/site-packages/gh_md_to_html/__init__.py", line 400, in formula2svg
        svg_element_soup_representation["class"] = "gh-md-to-html-formula"
    TypeError: 'NoneType' object does not support item assignment
    

    I've only tried gh-md-to-html file.md and gh-md-to-html --math true --emoji-support 0 --dont-make-images-links true file.md -p \<name\>.pdf which I found in the README so far, but this error probably comes from my own environment. I'm running Fedora 36 Plasma, and I tried to update everything on pip. Any pointers on what could be my problem ? Otherwise great software, just what I neede, keep at it !

    opened by rigobert9 1
  • Typo ':' after Advantages & Features in readme

    Typo ':' after Advantages & Features in readme

    There's a colon in the readme which appears to be a typo:

    <!--Advantages include<sup>(sorted by importance; skip the rest as soon as you're convinced!</sup>-->:
    

    should probably be just:

    <!--Advantages include<sup>(sorted by importance; skip the rest as soon as you're convinced!</sup>-->
    

    In both Chrome and Firefox browsers for me the colon only appears after the section has been expanded, and when it does appear it is on the line after the summary/header. Since there is a colon in the sentence introducing the section ("Here is a (not necessarily extensive) list of its advantages and features:") already and because it drops down in that way, it seems out of place.

    On a more personal note, thank you for being so open to feedback, even on tiny things. As somebody new to GitHub, I wouldn't have been brave enough to make a note of it here without your very welcoming and friendly invitation to do so.

    Thank you so much for making this project and for making it open source! Your project was the first google result for me when I searched 'github markdown to HTML' for a project I'm starting on, and I'm very glad to have found it.

    documentation ToDo 
    opened by FreshAlacrity 1
Releases(v0.0.136)
  • v0.0.136(Apr 10, 2021)

  • v0.0.135(Apr 10, 2021)

  • v0.0.134(Apr 10, 2021)

  • v0.0.133(Apr 9, 2021)

  • v0.0.132(Apr 9, 2021)

  • v0.0.131(Apr 9, 2021)

  • v0.0.130(Apr 9, 2021)

  • v0.0.129(Apr 8, 2021)

  • v0.0.128(Apr 3, 2021)

  • v0.0.127(Apr 3, 2021)

  • v0.0.126(Apr 3, 2021)

  • v0.0.125(Mar 29, 2021)

  • v0.0.124(Mar 29, 2021)

  • v0.0.123(Mar 29, 2021)

  • v0.0.122(Jan 5, 2021)

  • v0.0.120(Dec 5, 2020)

  • v0.0.121(Jan 5, 2021)

  • v0.0.119(Nov 4, 2020)

  • v0.0.118(Nov 3, 2020)

  • v0.0.117(Oct 31, 2020)

  • v0.0.116(Oct 31, 2020)

  • v0.0.115(Oct 31, 2020)

  • v0.0.114(Oct 31, 2020)

  • v0.0.113(Oct 31, 2020)

  • v0.0.112(Oct 31, 2020)

  • v0.0.111(Oct 28, 2020)

  • v0.0.110(Oct 28, 2020)

  • v0.0.109(Oct 28, 2020)

  • v0.0.108(Oct 28, 2020)

  • v0.0.107(Oct 28, 2020)

Owner
phseiff
Creating holistic software with a social vision in their freetime. Probably programming and being creative atm.
phseiff
A command line utility to export Google Keep notes to markdown.

Keep-Exporter A command line utility to export Google Keep notes to markdown files with metadata stored as a frontmatter header. Supports exporting: S

Nathan Beals 85 Dec 17, 2022
A command-line utility that, given a markdown file, checks whether all its links work.

A command-line utility written in Python that checks validity of links in a markdown file.

Teclado 2 Dec 8, 2021
A Python module and command-line utility for converting .ANS format ANSI art to HTML

ansipants A Python module and command-line utility for converting .ANS format ANSI art to HTML. Installation pip install ansipants Command-line usage

null 4 Oct 16, 2022
GetRepo-py is a command line client that queries GitHub API and searches repositories by given arguments

GetRepo-py is a command line client that queries GitHub API and searches repositories by given arguments

Davidcin 3 Feb 14, 2022
Python script to tabulate data formats like json, csv, html, etc

pyT PyT is a a command line tool and as well a library for visualising various data formats like: JSON HTML Table CSV XML, etc. Features Print table o

Mobolaji Abdulsalam 1 Dec 30, 2021
ddgr is a cmdline utility to search DuckDuckGo (html version) from the terminal

ddgr is a cmdline utility to search DuckDuckGo (html version) from the terminal. While googler is extremely popular among cmdline users, in many forums the need of a similar utility for privacy-aware DuckDuckGo came up. DuckDuckGo Bangs are super-cool too! So here's ddgr for you!

Piña Colada 2.5k Dec 25, 2022
QueraToCSV is a simple python CLI project to convert the Quera results file into CSV files.

Quera is an Iranian Learning management system (LMS) that has an online judge for programming languages. Some Iranian universities use it to automate the evaluation of programming assignments.

Amirmahdi Namjoo 16 Nov 11, 2022
Ralph is a command-line tool to fetch, extract, convert and push your tracking logs from various storage backends to your LRS or any other compatible storage or database backend.

Ralph is a command-line tool to fetch, extract, convert and push your tracking logs (aka learning events) from various storage backends to your

France Université Numérique 18 Jan 5, 2023
A simple CLI to convert snapshots into EAVT log, and EAVT log into SCD.

EAVT helper CLI Simple CLI to convert snapshots into eavt log, and eavt log into slowly changing dimensions Usage Installation Snapshot to EAVT log EA

null 2 Apr 7, 2022
Joji convert a text to corresponding emoji if emoji is available

Joji Joji convert a text to corresponding emoji if emoji is available How it Works ? 1. There is a json file with emoji names as keys and correspondin

Gopikrishnan Sasikumar 28 Nov 26, 2022
Convert ACSM files to DRM-free EPUB files with one command on Linux

Knock Convert ACSM files to DRM-free EPUB files using one command. This software does not utilize Adobe Digital Editions nor Wine. It is completely fr

Benton Edmondson 622 Dec 9, 2022
A tool to automatically convert old string literal formatting to f-strings

flynt - string formatting converter flynt is a command line tool to automatically convert a project's Python code from old "%-formatted" and .format(.

Elijah K 551 Jan 6, 2023
Convert shellcode into :sparkles: different :sparkles: formats!

Bluffy Convert shellcode into ✨ different ✨ formats! Bluffy is a utility which was used in experiments to bypass Anti-Virus products (statically) by f

pre.empt.dev 305 Dec 17, 2022
A python based command line tool to compare Github Users or Repositories

gitcomp A simple python package with a CLI to compare GitHub users and repositories by associating a git_score to each entry which is a weighted sum o

Anirudh Vaish 5 Mar 26, 2022
🐍 Python CLI tool to get public information from a GitHub account

?? Gitter ?? Python CLI tool to get public information from a GitHub account ?? What's this? Gitter is a open-source project created to easily uses th

opp? 3 Oct 14, 2022
Custom 64 bit shellcode encoder that evades detection and removes some common badchars (\x00\x0a\x0d\x20)

x64-shellcode-encoder Custom 64 bit shellcode encoder that evades detection and removes some common badchars (\x00\x0a\x0d\x20) Usage Using a generato

Cole Houston 2 Jan 26, 2022
A terminal UI dashboard to monitor requests for code review across Github and Gitlab repositories.

A terminal UI dashboard to monitor requests for code review across Github and Gitlab repositories.

Kyle Harrison 150 Dec 14, 2022
Command Line (CLI) Application to automate creation of tasks in Redmine, issues on Github and the sync process of them.

Task Manager Automation Tool (TMAT) CLI Command Line (CLI) Application to automate creation of tasks in Redmine, issues on Github and the sync process

Tiamat 5 Apr 12, 2022
A selfbot made with DPY, doesn't have much commands but there's some useful commands to use.

Phantom Selfbot A selfbot made in DPY, made by Zenith. How to use Add your token in token = 'YOUR-MOMS-TOKEN-HERE' Change the prefix in prefix = > If

[Ͼ⁴] Ƶephyr 2 Dec 2, 2021