Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active April 4, 2025 01:28
Show Gist options
  • Save plembo/409a8d7b1bae66622dbcd26337bbb185 to your computer and use it in GitHub Desktop.
Save plembo/409a8d7b1bae66622dbcd26337bbb185 to your computer and use it in GitHub Desktop.
Convert docx to markdown with pandoc

Convert Word documents to markdown with pandoc

I use pandoc to convert masses of Word documents to markdown. Still working on a generic script, but for now here's the "gist" of what I type into the terminal:

$ myfilename="example"
$ pandoc \
-t markdown_strict \
--extract-media='./attachments/$myfilename' \
$myfilename.docx \
-o $myfilename.md

Pandoc markdown is nice, but with Word documents it often adds odd things in translation. Stick to markdown_strict to avoid that.

I try to organize media (images, etc) embedded in documents under an attachments subdirectory with folders named for each file. This helps avoid "collision" between media file names and makes conversion out of markdown into other formats (HTML, PDF) less messy.

@mattman-ps
Copy link

Nice. Thanks for the tips ;-)

@Mjboothaus
Copy link

Thanks

@iambumblehead
Copy link

works perfectly

@mrtngrsbch
Copy link

cool, nice gist !

@STrRedWolf
Copy link

This helps get me 90% of the way there. I use a mix of 'markdown+bracketed_spans+backtick_code_blocks+fenced_code_attributes+fenced_divs' but I have to manually re-add the []{custom-style="foobar"} code as well as the horizontal lines... well, close...

@Inya-Celestine
Copy link

MINI PROJECT ON CONDUCT A PERSONAL CYBER HYGIENE AUDIT
Areas of Audit are as follows:

  1. Passwords and Authentication:
    a. Are your passwords strong, unique, and regularly updated?
    Answer: Yes, they are strong and unique but not regularly updated.
    b. Do you use a password manager or enable multi-factor authentication (MFA)?
    Yes, I enable multi-factor authentication.

  2. Device Security:
    a. Are your devices protected by updated antivirus software and firewalls?
    Answer: No
    b. Do you keep your operating system, smartphone, and software/ applications up to date? Yes.

  3. Social Media Privacy:
    a. Are your social media profiles configured for maximum privacy?
    Answer: Yes
    b. Are you currently oversharing personal information, and do you regularly review privacy settings? No, I don’t overshare personal information but review privacy settings.

  4. Email Practices:
    a. Do you recognize and avoid phishing attempts?
    Answer: Yes.
    b. How do you verify email sources, and what do you do when you see suspicious links?
    Answer: I verify email source by checking the sender's email address, looking for red flags in the email content, verify the email header, checking for domain authentication and when I see suspicious link, I don’t click on suspicious links or attachments but delete the link(s).

  5. Data Backup:
    a. Do you regularly back up important data to secure locations?
    Answer: Not really.
    b. Do you encrypt your data?
    Answer: Yes.
    Risk Analysis:

  6. Password not regularly updated can lead increased risks of unauthorized access to my accounts, including potential identity theft, data breaches, and financial loss.

  7. Failing to update antivirus software and firewalls leaves my devices vulnerable to a range of cyber threats, including malware infections, data breaches, and system crashes, potentially leading to financial loss, reputational damage, and legal issues.

  8. Failing to back up data can lead to serious consequences, including permanent data loss due to accidents, human error, cyberattacks, hardware failures, or natural disasters, potentially impacting productivity, financial stability, and even business closure.
    Action Plan: I will implement Regular changing of my password to limits the exposure to long-term compromise. It’s important that I regularly have the latest updates of antivirus software installed on my devices and carryout periodic scanning. To "remedy" data loss or corruption, a proactive approach involving regular data backups is crucial. Consider options like cloud storage, external hard drives, or specialized backup software to create copies of your data, ensuring its safety and accessibility in case of unforeseen circumstances. I will then regularly monitor my cybersecurity practices and update them as needed. And stay informed about the latest cybersecurity threats and trends to proactively protect yourself from potential risks.

@plembo
Copy link
Author

plembo commented Mar 11, 2025

Inya?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment