Convert Docx To Markdown With Specific Tables

37 views Asked by At

I am using pandoc to convert my .docx to .md but getting a table as HTML in the output.
How to make it return a simple markdown table (with pipes)?

command:
pandoc -f docx -t gfm /Users/andrewshostak/Downloads/MV-family-datasheet-240207-r4-1.docx -o res.md

output:

...
# Indoor cameras

<table>
<colgroup>
<col style="width: 13%" />
<col style="width: 14%" />
<col style="width: 14%" />
<col style="width: 14%" />
<col style="width: 14%" />
<col style="width: 14%" />
<col style="width: 14%" />
</colgroup>
<thead>
<tr class="header">
<th></th>
<th><p><strong>MV2-HW</strong></p>
<blockquote>
<p><img src="media/image3.png" style="width:0.72in;height:0.48in" /></p>
</blockquote></th>
<th><blockquote>
<p><strong>MV12WE-HW</strong></p>
<p><strong>MV12W-HW</strong></p>
<p><strong>MV12N-HW</strong><img src="media/image4.png"
style="width:0.72018in;height:0.48in" /></p>
</blockquote></th>
...

have already tried pandoc with different -t argument values:

  • markdown_mmd and commonmark: return the same
  • markdown or with -t at all: provide a narrow table see below.
  • gfm-raw_html: have a [TABLE] text instead of a table itself

So how can I get just a table with pipes and possibly no images?

# Indoor cameras

+--------+---------+---------+---------+---------+---------+---------+
|        | **M     | >       | **MV    | **      | **MV    | **MV    |
|        | V2-HW** |  **MV12 | 13-HW** | MV22-HW | 32-HW** | 33-HW** |
|        |         | WE-HW** |         | MV2     |         |         |
|        | > !     | >       | > !     | 2X-HW** | > !     | > !     |
|        | [](medi | > **MV1 | [](medi |         | [](medi | [](medi |
|        | a/image | 2W-HW** | a/image | > !     | a/image | a/image |
|        | 3.png){ | >       | 5.png){ | [](medi | 7.png){ | 8.png){ |
|        | width=" | >       | width=" | a/image | width=" | width=" |
|        | 0.72in" |  **MV12 | 0.50333 | 6.png){ | 0.39333 | 0.39in" |
|        | > he    | N-HW**! | 3333333 | width=" | 3333333 | > hei   |
|   

What I need:

|                       | MV52-HW           | MV63-HW MV63X-HW          | MV72-HW MV72X-HW                  | MV93-HW MV93X-HW                  |
|-----------------------|-------------------|---------------------------|----------------------------------|----------------------------------|
| **Camera type**       | Telephoto bullet  | Fixed-lens mini dome      | Varifocal dome                   | Fisheye                          |
| **Sensor and resolution** | 8.4MP (3840x2160) | 8.4MP (3854x2176) MV63HW/4K (3840x2160) HW63X-HW | MV72-HW (1920x1080)/4MP (2688x1520) | MV93-HW (2112x2112)/12.4MP (4072x3046) MV93X-HW |
| **Field of View**     | 12-37°            | 102°                      | Horizontal 36-112°, vertical 20-57°, diagonal 42-138° | 360°                            |
| **Storage**           | 1TB               | 256GB (MV63-HW)/1TB       | 256GB (MV72-HW)/512GB             | 256GB (MV93-HW)/1TB              |
| **Ratings**           | IK10+/IP67        | IK10+/IP67                | IK10+/IP67                        | IK10+/IP67                      |
| **IR illumination**   | 50m               | 20m                       | 30m                               | 20m                             |
| **Best for**          | Ideal for parking lots or perimeter monitoring including license plate capture | Ideal for entrances and exits, Filter-based attributes (top/ bottom clothing color and make and color of vehicle) | A variety of outdoor and demanding environments | Ideal for situational awareness and wide coverage of an area |

0

There are 0 answers