nutsack
@nutsack@lemmy.dbzer0.com
- Comment on Anon likes pizza 12 hours ago:
I’m sorry but you can’t make a pizza for a $1.50
- Comment on What's the best free version of word? 4 days ago:
I could not get pandoc to work on my system. after a few attempts going in circles with dependency packages, I gave up
- Comment on With what's happening in Gaza, what can we as socialists (and non-socialists) do to fix Gaza? 5 days ago:
you could try protesting and getting shot by cops
- Comment on What's the best free version of word? 5 days ago:
I am composing documents in markdown format and then using a python script to produce a PDF:
#!/usr/bin/env python3 """Convert Markdown files to PDF.""" import argparse import sys from pathlib import Path try: import markdown from weasyprint import HTML, CSS except ImportError: print("Missing dependencies. Install with:") print(" pip install markdown weasyprint") sys.exit(1) CSS_STYLES = """ @page { margin: 0.5in 0.6in; size: letter; } body { font-family: "Courier New", Courier, "Liberation Mono", monospace; font-size: 10pt; line-height: 1.4; color: #222; max-width: 100%; } h1, h2, h3 { margin-top: 1em; margin-bottom: 0.3em; padding-bottom: 0.2em; } h1 { font-size: 16pt; } h2 { font-size: 13pt; } h3 { font-size: 11pt; } h4 { font-size: 10pt; font-weight: normal; margin-bottom: 0.5em;} ul { margin: 0.3em 0; padding-left: 1.2em; } li { margin-bottom: 0.2em; } p { margin: 0.4em 0; } p + p { margin-top: 0.2em; } strong { font-weight: bold; } """ PAGE_BREAK_MARKER = "<!-- pagebreak -->" PAGE_BREAK_HTML = '<div style="page-break-before: always;"></div>' def process_page_breaks(html_content: str) -> str: """Replace page break markers with actual page break HTML.""" return html_content.replace(PAGE_BREAK_MARKER, PAGE_BREAK_HTML) def md_to_html(input_path: Path) -> str: """Convert a Markdown file to HTML content.""" md_content = input_path.read_text(encoding="utf-8") html_content = markdown.markdown(md_content) return process_page_breaks(html_content) def convert_md_to_pdf(input_paths: list[Path], output_path: Path) -> None: """Convert one or more Markdown files to a single PDF.""" html_parts = [] for i, input_path in enumerate(input_paths): if i > 0: html_parts.append(PAGE_BREAK_HTML) html_parts.append(md_to_html(input_path)) full_html = f""" <!DOCTYPE html> <html> <head><meta charset="utf-8"></head> <body>{"".join(html_parts)}</body> </html> """ HTML(string=full_html).write_pdf(output_path, stylesheets=[CSS(string=CSS_STYLES)]) print(f"Created: {output_path}") def main(): parser = argparse.ArgumentParser(description="Convert Markdown files to PDF") parser.add_argument("files", nargs="*", type=Path, help="Markdown files to convert") parser.add_argument("-o", "--output", type=Path, help="Output PDF path") parser.add_argument("-m", "--merge", action="store_true", help="Merge all input files into a single PDF") args = parser.parse_args() # Default to all .md files in current directory files = args.files if args.files else list(Path(".").glob("*.md")) if not files: print("No Markdown files found") sys.exit(1) if args.merge: if not args.output: print("Error: --output is required when using --merge") sys.exit(1) for md_file in files: if not md_file.exists(): print(f"File not found: {md_file}") sys.exit(1) convert_md_to_pdf(files, args.output) else: if args.output and len(files) > 1: print("Error: --output can only be used with a single input file (or use --merge)") sys.exit(1) for md_file in files: if not md_file.exists(): print(f"File not found: {md_file}") continue output_path = args.output if args.output else md_file.with_suffix(".pdf") convert_md_to_pdf([md_file], output_path) if __name__ == "__main__": main()
- Comment on If the color of the Sun was orange, wouldn't the clouds and everything white also be orange? My friend is adamant that 30 years ago the "real" Sun was orange but got replaced with a white LED. 6 days ago:
- Comment on How can we convince Trump voters to NOT vote for Trump (or Vance) in the 2026 midterms and the 2028 election? 1 week ago:
That’s not what you should be trying to do. The answer is to get Democrats someone to vote for that they’ll actually come out and vote for. a lot of them just don’t vote because their choices are shit
- Comment on Anon goes to therapy 1 week ago:
therapist is offering to suck his dick and he’s just not getting it
- Comment on Are you people all bots? 1 week ago:
yea
- Comment on Are you people all bots? 1 week ago:
correctly an ai cannot suck your dick. That’s how you know
- Comment on Anon has a tip 1 week ago:
you can do this with most other search engines i think by prefixing your search with the URL of the website
- Comment on Bethesda announces a new Fallout... reality show 1 week ago:
the show is ok but this is dumb i don’t like it
- Comment on Bully Online, the ambitious mod that brought multiplayer and more to Rockstar's classic school sim, shuts down a month after launch: 'This was not something we wanted' 2 weeks ago:
as long as they keep making really good games I’ll keep buying them and playing them. if they want to be dicks about their intellectual property, that’s a bummer, but at least they’re making good games
- Comment on Bully Online, the ambitious mod that brought multiplayer and more to Rockstar's classic school sim, shuts down a month after launch: 'This was not something we wanted' 2 weeks ago:
Rockstar also kills off mods that are free
- Comment on At this point, what should we do about the ICE raids? If an ICE agent breaks in without a warrant or holds you at gunpoint, what do you do? 2 weeks ago:
film them. that’s about it
- Comment on How do I properly and safely clean smartphone? 2 weeks ago:
I smear my balls all over everything. I don’t give a fuck
- Comment on Anon uses 4chan 2 weeks ago:
no don’t do it
- Comment on If you're a parent, how do you prevent your kid from watching AI slop? 2 weeks ago:
I don’t have kids but I keep seeing iPad baby bullshit and that is fucking disgusting. that’s one of the reasons why it probably won’t have any
- Comment on How do I properly and safely clean smartphone? 2 weeks ago:
what did you do? why the fuck do you need to clean it
- Comment on Anon uses 4chan 2 weeks ago:
culture
- Comment on Anon uses 4chan 2 weeks ago:
rar
- Comment on Anon finds enlightenment 2 weeks ago:
I don’t understand the analogy it’s a simple question
- Comment on Anon watches Super Size Me 2 weeks ago:
yeah fast food is disgusting. that’s about right
- Comment on I'm lit deal with it 😎 3 weeks ago:
caffeine should be a scheduled substance
- Comment on I am so scared of nuclear war, how do I cope with it? 3 weeks ago:
The only thing you can do is move away from a major city. and after that you can’t do shit. So don’t worry about it. it’s fine
check out that movie Dead Man’s letters. it’s really good.
- Comment on Who is going to be the next Pres of Venezula after all this US stuff? 3 weeks ago:
Steven
- Comment on How Are You Guys Handling This? 3 weeks ago:
no, it does not.
a lot of mac games that came out before apple silicon simply will not run.
ive had mostly poor results trying to run games with crossover and whisky.
your best bet is to stick with the limited selection of games that have native apple silicon releases. with these and my m2 mac mini im still experiencing some pretty bad input lag. i am sticking to rimworld and stellaris.
- Comment on How Are You Guys Handling This? 3 weeks ago:
you are seriously limited on the games. you can play with the Apple silicon Mac
- Comment on Can pets tell who's petting them without looking? 4 weeks ago:
that’s how they say hello
- Comment on How is Donald Trump able to get away with being part of a child trafficking ring but I get 20 years in jail for littering? 4 weeks ago:
can you explain this littering thing im interested i love crime
- Comment on Do I have extreme anxiety? 4 weeks ago:
probably. take care of it sooner than later in order to avoid having a stroke or whatever