Skip to content

Instantly share code, notes, and snippets.

View pvgenuchten's full-sized avatar

Paul van Genuchten pvgenuchten

View GitHub Profile
@pvgenuchten
pvgenuchten / word tables to markdown using pandoc
Last active August 30, 2023 13:42
markdown from word docx (not) using pandoc
# I tried markdown addin by Britva from https://appsource.microsoft.com/en-us/product/office/WA200002866, but it doesn't do tables
# By default pandoc renders tables using pandoc markdown conventions, which breaks up cell content on multiple lines (breaking in the middle of a hyperlink, rendering invalid markdown)
pandoc -s foo.docx -t markdown -o foo.md
# Seems there is a number of table plugins that enable you to finetune the behaviour
pandoc -s foo.docx -t markdown-simple_tables-multiline_tables-grid_tables -o foo.md
# In many scenario's (seems related to the column width being more then a treshold) this approach breaks and pandoc
@pvgenuchten
pvgenuchten / tms in leaflet
Created June 17, 2022 10:27
tms in leaflet
<html><body>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css" integrity="sha512-hoalWLoI8r4UszCkZ5kL8vayOGVae1oxXe/2A4AO6J9+580uKHDO3JdHb7NzwwzK5xr/Fs0W40kiNHxM9vyTtQ==" crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js" integrity="sha512-BB3hKbKWOc9Ez/TAwyWxNXeoV9c1v6FIeYiBieIWkpLjauysF18NzgR1MBNBXf8/KABdlkX68nAhlwcDFLGPCQ==" crossorigin=""></script>
<div id="map2" style="width:80%;height:400px"></div>
<script>
var map = L.map('map2', {
center: [51.505, -0.09],
zoom: 6
});
@pvgenuchten
pvgenuchten / mapml.html
Last active June 15, 2022 07:10
hugo shortcode for mapml map
<!--
Install:
Copy this file into /layouts/shortcodes
Usage:
{{% mapml %}}
<mapml-viewer projection="OSMTILE" zoom="0" lat="0.0" lon="0.0" controls style="width:100%;height:400px">
# Goal of the script is export an existing site to hugo markdown
# use httrack or some other tool to download the full website
# then run this script to convert the local copy to markdown
# verify that the header and footer are properly removed (by setting the split point)
# copy the markdowns into the hugo content section
import os
from markdownify import markdownify as md