I created a workflow to create a new markdown with a custom prism HTML header. The copied snippet will have the code block tag appended in the clipboard so that all you have to do is paste the snippet into the note. Full automation was unsuccessful due to limitations found, listed below.
- Open the Siri shortcut and go into edit mode by tapping the three dots
- Locate the menu card
- Under “choose from menu” tap add new item.
- Rename it to the language name
- Add a text card under the newly created list item and type the name of the language inside the text card
- Repeat this process for other languages
- Encode your prism HTML header with urlencode.org,
- this being the header that points to the CSS and JS prism files
- Paste your encoded header in the text card where it says “paste encoded header here”
- Tap done to exit workflow editor
- Copy a code snippet
- Using the share menu launch the workflow
- You can also tell Siri to run the shortcut
- Select the language when prompted
- A new markdown note will be created in the global inbox
- Open the new note created & paste
- the pasted snippet will automatically contain the code block tags
Feel free to customize the workflow just be aware of the current limitations.
Current X-url / Shortcuts Limitations
- Shortcuts does not encode forward slashes therefore the encode action was not used
- Code snippets with an equal sign cuts off any proceeding text therefore appending clipboard items to the x-url is not advised
- If variables / time are added to the x-url title, the html prism header will not decode. You can rename the title but don’t add variables