Package: txt2pdf
txt2pdf : Convert Markdown files to PDF with styles.Initially forked fromhttps://github.com/jmaupetit/md2pdfInstallationAvailable through pip:$pipinstalltxt2pdfUsageAs a CLIUsage:
    txt2pdf [options] INPUT.MD OUTPUT.PDF

Options:
    --css=STYLE.CSSFor example, try to generate the project documentation with:$txt2pdfREADME.mdREADME.pdfOptionally, you may load an external style (restricted to CSS2):$txt2pdf--csstests/resources/input.cssREADME.mdREADME.pdfYou may also include a HTML header and footer :$txt2pdf--headertests/resources/header.htmlREADME.mdREADME.pdf
$txt2pdf--footertests/resources/footer.htmlREADME.mdREADME.pdfOptional debug by printing HTML to stdout, includes optional header and footer :$txt2pdf--html-to-stdoutREADME.mdREADME.pdfAs a libraryfromtxt2pdf.coreimporttxt2pdftxt2pdf(pdf_file_path,md_content=None,md_file_path=None,css_file_path=None,html_header_content=None,html_header_file_path=None,html_footer_content=None,html_footer_file_path=None,base_url=None,print_html_to_stdout=False,)Function arguments:pdf_file_path: output PDF file pathmd_content: input markdown raw string contentmd_file_path: input markdown file pathcss_file_path: input styles path (CSS)html_header_content: input HTML header raw string contenthtml_header_file_path: input HTML header file pathhtml_footer_content: input HTML footer raw string contenthtml_footer_file_path: input HTML footer file pathbase_url: absolute base path for markdown linked content (as images)print_html_to_stdout: print HTML to stdout for debug purposesWith DockerInstallDockerBuild the image:$dockerbuild-ttxt2pdf.Now run your image:$dockerrun--rm-v$PWD:/apptxt2pdf--cssstyles.cssINPUT.MDOUTPUT.PDFTroubleshooting on MacOSXEnsure, Weasyprint is fully functional before using txt2pdf. You will find
installation instructions in the project documentation:https://weasyprint.readthedocs.io/en/latest/install.htmlIn a few words, here are the few steps you will need to follow:Install XQuartz from:https://xquartz.macosforge.orgInstall all dependencies at once withhomebrewand go grab a coffee (this may
take a while):$brewinstallcairopangogdk-pixbuflibxml2libxsltlibffiMiscUsing custom fonts in stylesWeasyPrint does not support the@font-faceproperty yet (seeproject issue
28). If you use want to use
custom fonts, you should use system fonts and define them with thefont-familyCSS property, like:font-family: 'Neutraface Condensed';Note that you should only defineone singlecustom font, not a substitution list.Using code blocksGenerate default css defining a class for every code item type:(venv)$pygmentize-Sdefault-fhtml-a.codehiliteContributingHackingClone this project first:$gitclonegit@github.com:c4ffein/txt2pdf.gitInstall it with its dependencies (ideally in a virtual environment):$cdtxt2pdf
$python-mvenvvenv
$.venv/bin/activate(venv)$pipinstall.[dev]Running the test suiteTo run the test suite with your active python version (virtual environment):(venv)$pytestLint the code via:(venv)$black-l120Release a new version(venv) $ pip install .[deploy]  # install flit if needed
(venv) $ flit publish --format sdistLicensetxt2pdfis released under the MIT License. See the LICENSE file for details.