typora-issues icon indicating copy to clipboard operation
typora-issues copied to clipboard

Feature Request: Highlight specific lines and/or line ranges

Open smerth opened this issue 6 years ago • 15 comments

Hello, Thanks for such a great app. Typora is at the core of my daily workflow and I love it. I author md files that I pass to websites I have built or to an ebook authoring app. In both cases the md files are parsed and the code blocks are highlighted using prism.js

Prism has a feature called: Highlight specific lines and/or line ranges .

I can indicate which lines in a code block I want the reader to focus attention on by appending the lines the language specifier in the code block in the md file, for example...

```javascript{12-43}

wraps the lines 12 to 43 in a class I use to focus the reader on those lines within a code block 

This will ensure that those lines get wrapped in a class that I can target with css to call them out to the readers attention.

Unfortunately this breaks the code highlighting in Typora...

If anything is appended to the language type specifier for the code block like {1, 25-27} Typora doesn't highlight the entire code block..

Can you implement this in Typora... Or, can you allow this kind of line specification in curly braces to follow the language specification for code blocks without breaking Typora highlighting?

Thanks, Smerth

smerth avatar Mar 23 '18 22:03 smerth

I think this is what I am looking for also. If we can highlight in code fence that will be perfect

jacquen avatar Apr 03 '18 00:04 jacquen

Just started using Typora and this is also the first thing I was searching for.

shinragriever avatar May 05 '19 17:05 shinragriever

Hi, this is something I am also looking for. Would be great to be able to highlight text within a code block. Thanks

sitting-ducks avatar May 27 '19 10:05 sitting-ducks

I look forward to it. I am using the prism highlighter with line highlight. If the typora has this feature, it would be great!!

youngdeok avatar Sep 05 '19 16:09 youngdeok

I'd also find the ability to highlight within code fences very useful.

marcusyoung avatar Jan 09 '20 14:01 marcusyoung

Just started using Typora, and it was the first feature I looked for. That would be great if you add it sooner.

amirmuhsin avatar Jan 17 '20 10:01 amirmuhsin

If we can mark some code pieces in code fence. That will be a great feature !

yujiahaol68 avatar Mar 27 '20 05:03 yujiahaol68

Vote for this. Atom's Markdown Preview Enhanced has these feature supported.

```gas {.line-numbers, highlight=4}
targetFunc:
    stmdb   sp!, {r4-r12, lr}
    sub     sp, sp, #0x20
    add     r1, sp, #4
    str     r1, [sp, #8]
    ldr     r3, [sp, #8]
    ldr     r4, [sp, #0xc]
    add     sp, sp, #0x20
    ldmia   sp!, {r4-r12, pc}

Which yields the following result. image

Hope Typora can have this feature in the future.

ericsunplus avatar Aug 07 '20 07:08 ericsunplus

I'ld love this feature too. In my case to highlight the comments inside the code because I use typora to take notes and document my projects.

takeshi-mb avatar Feb 13 '21 15:02 takeshi-mb

This is a very useful feature for documentation in markdown, please can you work on it 🙏

hukar avatar May 14 '22 06:05 hukar

Please integrate syntax highlighter such as shiki or prism

diomed avatar Jul 06 '23 17:07 diomed

我也希望有这个功能,这个功能非常有用!

shuqiang0 avatar Oct 24 '23 05:10 shuqiang0

It would be so so great if you could integrate this feature, it is incredibly useful.

fallingleavesz avatar Dec 10 '23 18:12 fallingleavesz

Please add the Highlight specific lines and/or line ranges to the next release

gamgamstylep avatar Apr 30 '24 06:04 gamgamstylep

Hope can be integrated shiki inside, for editing code documentation has a lot of help

wskaudh avatar Jun 21 '24 08:06 wskaudh