Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
Last active October 12, 2023 21:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninmonkey/5c0d3b1811c3c691df1f63ca6b01b55d to your computer and use it in GitHub Desktop.
Save ninmonkey/5c0d3b1811c3c691df1f63ca6b01b55d to your computer and use it in GitHub Desktop.
Template for readme.md using screenshots

template-with-images.md

This example organizes all the non-pbix files in subdirectories.
Imagine main is a local folder, ex: inside the root folder: `c:\git\PowerQuery

The absolute path to my screenshot is:

c:\git\PowerQuery\img\title.screenshot.png

The relative path from the readme will be

./img/title.screenshot.png

links

[link title](./pq/title.pq)
[report.pbix](./report.pbix)

Images

![alt text](./img/title.screenshot.png)

Here's what the subdirectories look like:

/main    
    /img
        title.screenshot.png
    /pq
        title.pq
        
    title.pbix
    readme.md

Note: You won't see the image on this screen, because there's no image in this gist. In the real repo, it'll display your image.

References / See More:

If you want to go crazy

I dynamically build toc.md using PowerShell. The top toc.ps.md file is one line, it calls a macro.

Beware, this part is messy. But if you're curious, the file import.ps1 declares the important functions: repo.WriteFileSummary, md.Path.escapeSpace, md.Write.Url

Web Requests

Catching Web.Contents Errors using and ManualStatusHandling

links:

title.pq

screenshots:

screen reader name report.pbix

this shows code with syntax highlighting

try Web.Contents( "https://httpbin.org", [
    RelativePath =  "/status/codes/418",
    ManualStatusHandling = {401, 402, 404} & {405..500}
    ] )
catch (e) =>
    "Error, but we caught it" meta e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment