Bug 356974 - Support for syntax highlighted fenced code blocks in Markdown
Summary: Support for syntax highlighted fenced code blocks in Markdown
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 389307 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-12-20 23:27 UTC by Elvis Stansvik
Modified: 2020-03-14 15:42 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
A simple patch stub, with support for PHP and Python (2.49 KB, patch)
2017-08-22 18:54 UTC, Grzegorz Szymaszek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elvis Stansvik 2015-12-20 23:27:32 UTC
This may be a pipe dream, because I don't know if Kate's highlighting engine is capable of switching highlighting rules in the middle of a file, but it would be awesome if I could do

## Look some C++

```cpp
int main(int argc, char *argv[])
```

## And some Python

```python
def hello():
    print("Hello there")
```

when editing a Markdown file in Kate. Similar to what you can do at e.g. GitHub.

This would mean

  1) support for fenced code blocks,
  2) support for switching to appropriate syntax highlighting rule within such blocks.

Anyway, if it's completely out of the question, I rest my case.

Thanks a lot for Kate!

Reproducible: Always
Comment 1 Elvis Stansvik 2015-12-20 23:32:05 UTC
I should add that, should Kate gain a live Markdown preview, which I've heard people ask for, then this wish could almost be thrown in the garbage, since I think it would then be easy to let that live preview be powered by a Markdown formatter that supports fenced code blocks.
Comment 2 Grzegorz Szymaszek 2017-08-22 18:54:31 UTC
Created attachment 107453 [details]
A simple patch stub, with support for PHP and Python

It is possible to switch syntax highlighting as it is done in the attached patch (hopefully without that much repeating).

Another interesting solution: https://frinring.wordpress.com/2017/08/21/look-what-you-have-donewwdo/
Comment 3 Christoph Feck 2017-09-17 14:52:43 UTC
Please upload patches to https://phabricator.kde.org/differential/diff/create/
Comment 4 Grzegorz Szymaszek 2018-02-25 09:39:07 UTC
*** Bug 389307 has been marked as a duplicate of this bug. ***
Comment 5 Grzegorz Szymaszek 2018-02-25 09:42:21 UTC
Relevant Phabricator Diff: https://phabricator.kde.org/D7864 (only PHP and Python supported).
Comment 6 Christoph Cullmann 2020-03-14 15:42:16 UTC
Patch was merged, even more languages got added over the last year.