aboutsummaryrefslogtreecommitdiff
path: root/content/blog/2024-04-06-convert-onenote-to-markdown.md
diff options
context:
space:
mode:
Diffstat (limited to 'content/blog/2024-04-06-convert-onenote-to-markdown.md')
-rw-r--r--content/blog/2024-04-06-convert-onenote-to-markdown.md100
1 files changed, 46 insertions, 54 deletions
diff --git a/content/blog/2024-04-06-convert-onenote-to-markdown.md b/content/blog/2024-04-06-convert-onenote-to-markdown.md
index 682969a..32de921 100644
--- a/content/blog/2024-04-06-convert-onenote-to-markdown.md
+++ b/content/blog/2024-04-06-convert-onenote-to-markdown.md
@@ -5,25 +5,23 @@ description = ""
draft = false
+++
-If you\'re looking to convert your OneNote content to another format,
-such as Markdown or Org-Mode, you\'re in luck. I use a solution that
-doesn\'t require other programs, such as Evernote or Notion. Personally,
-I used this solution on a managed corporate laptop that doesn\'t allow
-installation of other programs like these.
+If you're looking to convert your OneNote content to another format, such as
+Markdown or Org-Mode, you're in luck. I use a solution that doesn't require
+other programs, such as Evernote or Notion. Personally, I used this solution on
+a managed corporate laptop that doesn't allow installation of other programs
+like these.
This solution uses OneNote and Pandoc on Windows 10.
# Export OneNote Content to Word
-To start, export any pages or tabs from OneNote to the Word format
-(`.docx`):
+To start, export any pages or tabs from OneNote to the Word format (`.docx`):
-1. Open OneNote desktop.
-2. Select `File` and then `Export`.
-3. Select the scope of content to export, such as `Tab` or
- `Page`.
-4. Name and save the file in an easy to remember location. I recommend
- your Downloads or Desktop folder.
+1. Open OneNote desktop.
+2. Select `File` and then `Export`.
+3. Select the scope of content to export, such as `Tab` or `Page`.
+4. Name and save the file in an easy to remember location. I recommend your
+ Downloads or Desktop folder.
See below for a visual walkthrough of the export process.
@@ -39,46 +37,42 @@ Document](https://img.cleberg.net/blog/20240406-convert-onenote-to-markdown/word
# Download Pandoc
Start by downloading Pandoc from their [GitHub
-releases](https://github.com/jgm/pandoc/releases) page. I cannot install
-`.msi` files on my corporate laptop, so I downloaded the
-`pandoc-3.1.12.3-windows-x86_64.zip` file, which contains a
-simple `.exe` file that you do not need to install - you will
-simply run it from the command line below.
+releases](https://github.com/jgm/pandoc/releases) page. I cannot install `.msi`
+files on my corporate laptop, so I downloaded the
+`pandoc-3.1.12.3-windows-x86_64.zip` file, which contains a simple `.exe` file
+that you do not need to install - you will simply run it from the command line
+below.
-Once downloaded, unzip the archive and move the `pandoc.exe`
-file to the same folder where your Word documents were saved above. If
-you prefer, you can move this file to an easier location, such as
-`C:\Users\youruser\Downloads`.
+Once downloaded, unzip the archive and move the `pandoc.exe` file to the same
+folder where your Word documents were saved above. If you prefer, you can move
+this file to an easier location, such as `C:\Users\youruser\Downloads`.
# Convert Word to Markdown
-In this example, I will be converting the Word documents to Markdown,
-but Pandoc supports [a ton of different formats for
+In this example, I will be converting the Word documents to Markdown, but Pandoc
+supports [a ton of different formats for
conversion](https://github.com/jgm/pandoc?tab=readme-ov-file#the-universal-markup-converter).
-Choose the format you prefer and then modify the following commands as
-needed.
+Choose the format you prefer and then modify the following commands as needed.
-To perform the conversion, open the Command Prompt. If you can\'t find
-it, open the start menu and search for it.
+To perform the conversion, open the Command Prompt. If you can't find it, open
+the start menu and search for it.
-Within the command prompt, navigate to the directory where you stored
-the `pandoc.exe` file and the Word documents.
+Within the command prompt, navigate to the directory where you stored the
+`pandoc.exe` file and the Word documents.
```ps1
cd "C:\Users\yourusername\Downloads"
```
-You can verify that you\'re in the correct directory with the
-`dir` command.
+You can verify that you're in the correct directory with the `dir` command.
```ps1
dir
```
-Once you have verified that you have the command prompt open in the
-correct directory with the `pandoc.exe` and the Word
-documents, you can run the following loop to convert all Word documents
-to Markdown.
+Once you have verified that you have the command prompt open in the correct
+directory with the `pandoc.exe` and the Word documents, you can run the
+following loop to convert all Word documents to Markdown.
```ps1
for %f in (*.docx) do (pandoc.exe --extract-media=. --wrap=preserve "%f" -o "%f.md")
@@ -86,29 +80,27 @@ for %f in (*.docx) do (pandoc.exe --extract-media=. --wrap=preserve "%f" -o "%f.
This loop will perform the following actions:
-1. Find all documents matching the pattern `*.docx`, which
- means all Word documents ending with that file extension.
-2. Iterate through all files found in step 1.
-3. For each file, perform the pandoc command.
-4. Within the pandoc command, `--extract-media` saves all
- media found in the files to the current folder, with pandoc
- automatically creating a `media` subfolder to hold all
- images.
-5. Within the pandoc command, `--wrap=preserve` will attempt
- to prseerve the wrapping from the source document.
-6. Within the pandoc command, the final step is to specify the output
- path with `-o`. This option adds the `.md`
- file extension to recognize the output files as Markdown files.
+1. Find all documents matching the pattern `*.docx`, which means all Word
+ documents ending with that file extension.
+2. Iterate through all files found in step 1.
+3. For each file, perform the pandoc command.
+4. Within the pandoc command, `--extract-media` saves all media found in the
+ files to the current folder, with pandoc automatically creating a `media`
+ subfolder to hold all images.
+5. Within the pandoc command, `--wrap=preserve` will attempt to prseerve the
+ wrapping from the source document.
+6. Within the pandoc command, the final step is to specify the output path with
+ `-o`. This option adds the `.md` file extension to recognize the output files
+ as Markdown files.
![Pandoc
Conversion](https://img.cleberg.net/blog/20240406-convert-onenote-to-markdown/command.png)
-If you want to export to another format, simply specify the
-`-f=`/`--from=` and `-t=`/`--to=` options.
+If you want to export to another format, simply specify the `-f=`/`--from=` and
+`-t=`/`--to=` options.
-For example, you can convert the Word document to org-mode. You can also
-convert to one format and subsequently convert to other formats as
-needed.
+For example, you can convert the Word document to org-mode. You can also convert
+to one format and subsequently convert to other formats as needed.
```ps1
pandoc.exe -f docx -t org file.docx