typora / typora-issues

Bugs, suggestions or free discussions about the minimal markdown editor — Typora
https://typora.io
1.53k stars 58 forks source link

Feature Request: Highlight specific lines and/or line ranges #1349

Open smerth opened 6 years ago

smerth commented 6 years ago

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

jacquen commented 6 years ago

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

shinragriever commented 5 years ago

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

sitting-ducks commented 5 years ago

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

youngdeok commented 4 years ago

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

marcusyoung commented 4 years ago

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

amirmuhsin commented 4 years ago

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

yujiahaol68 commented 4 years ago

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

ericsunplus commented 3 years ago

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.

takeshi-mb commented 3 years ago

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.

hukar commented 2 years ago

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

diomed commented 1 year ago

Please integrate syntax highlighter such as shiki or prism

shuqiang0 commented 8 months ago

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

fallingleavesz commented 7 months ago

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

gamgamstylep commented 2 months ago

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

wskaudh commented 3 weeks ago

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