Drafts 5.9 (iOS) is now available in the App Store, details below.
-
New:
setAllSort(sortBy, sortDescending, sortFlaggedToTop)
method on Workspace
script object.
-
New: Fenced code blocks (```) will be highlighted in monospace font in MultiMarkdown and GitHub Markdown syntaxes. Also posted two new action examples which make good additions to a Markdown keyboard if you work with inline or code blocks:
-
Inline code: Wraps selection in back-ticks as inline code, or inserts back-tick if no selection.
-
Code Block: Wraps selection in triple back-ticks as code block, or inserts triple back-tick if no selection.
-
Fix: Sync sometime would not fail to properly update other devices when a draft was move archived/trashed.
For a complete history of updates, visit the changelog
Fenced code blocks do not appear to be working for me. I used the Code Block action to make sure there wasnât some character issue. There is a portion that is monospace, but I think that is just due to being indented.
Do you have MultiMarkdown or GitHub Markdown syntax selected for the Draft? Regular Markdown does not have fenced blocks, they are an extension to the syntax.
Hi,
It didnât work for me either, I tried in MultiMarkdown and Github Markdown for both my current drafts and all by default and neither worked.
Thanks a lot for your hard work !
Cheers
That appears to be working. The code block is in monospace font. That is the only formatting applied to a code block.
How it was you mean by higlighted ? I though Iâll have some code colouring syntax
Try to use a preview action:)
Well, itâs âsyntax highlightingâ. So any change to the text based on itâs content is part of the highlighting process. Sorry for lack of clarity.
I got excited with the fenced code blocks. Then found out that it doesnât do syntax highlighting. I hope that it will become a feature sometime in the future.
1 Like
While syntax highlighting would be nice all that âfenced code blocksâ (three backticks) implies is monospace - so itâs readable.
However, I believe there is syntax in some flavours to suggest what language the code block is in. But that is a separate function.
Oh ok, I misunderstood ! Do you have any plan to add some colouring depending on the code in fenced code block ?
Yep doesnât have any code colouring in this case, maybe Iâm missing somethings
For showing it in a preview, you just have to configure your preview to use an existing syntax highlighter.
For example, if we take some Markdown with a code block containing some HTML and some Javascript like thisâŚ
⌠and then use a custom preview action such as this (just a standard Drafts Preview action step that I added a couple of syntax highlighter enabling lines to), you could get a syntax highlighted preview like thisâŚ
End of the day, live syntax highlighting is non-trivial, and setting it to work with potentially multiple languages inside multiple code blocks; well, since Drafts isnât a full on IDE, Iâd say that may be overkill, or at least well down the road on the applicationâs road map.
Anyway, hope the preview action option might be of some use.