typora / typora-issues

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

set default programming language for document #290

Closed Bamieh closed 1 year ago

Bamieh commented 8 years ago

It would be nice if there is a global option per document to set the used programming language, so whenever i'm writing a code block, i get the default language preset for me, and i can modify if i need for certain code blocks.

I use Typora to write programming guides and notes, and i hate specifying the code block programming language every time i write "```".

AlexPasternak commented 8 years ago

This is very similar to what I suggested in #184, which was closed as "won't fix". Rather than default for the whole doc, I would even be happy if it defaulted to the previously selected one. I agree 100% that picking the same language every time is a hassle in a large doc with many code blocks.

Bamieh commented 8 years ago

@AlexPasternak for sure wouldnt mind the same as previous, although its a little inconvenient when you want to have one c++ block then one javascript block in alternation for example..

AlexPasternak commented 8 years ago

Sure, that makes sense, and I sometimes have alternating syntax blocks in documentation or notes as well. If a default setting would help to set the right syntax in ~ 50% of those cases, that would already be less work for me as a user.

toaco commented 7 years ago

I'm looking forward to this function, too. Recently, I'm learning Python, I have typed too many ```python.

BluesChang commented 7 years ago

I use Typora to write programming notes, and I cant stand specifying the code block programming language every time.

AlexPasternak commented 7 years ago

I'm very glad to hear others' supporting this basic function. When you type notes or docs that include code blocks, it becomes an obvious need. I really hope this is added soon in some form.

toaco commented 7 years ago

+++

abnerlee commented 7 years ago

I am considering improving this part by approaches like

a. better auto-complete function (auto suggestion the most recent one by default) b. decide default code block language by file extension. e.g. test.js.md -> js is the default language. c. add typora-default-lang in code fences.

Anyway, first, there should be an intuitive way for this kind of setting.

toaco commented 7 years ago

I suggest a menu option, when we click it, we can choose a language. Then Typora will fill language setting of all code fences in which language haven't been set.

Towards those code fence modified by Typora, a special background color will show for distinction. But when we save this file(Ctrl+S), it will recover to normal style.

Example: jeb yymlbga11 o nbe6 xs

pzhaonet commented 7 years ago

Totally agree with this suggestion. I am an R user. Typora will be perfect if this problem could be solved.

richard1017 commented 6 years ago

This is definitely the functionality I'm looking for. Writing ```{lang} repeatedly is neither pleasant nor productive.

mlntr commented 6 years ago

Support.

My notes always contain only one language so it's counterproductive and counterintuitive to have to keep selecting the language when making a new block.

Toaco's suggestion looks like a potentially good way of implementing this, or otherwise at least auto-detect most recent language.

vassudanagunta commented 6 years ago

Misspelling in the issue title: "lanauge".

ouweiya commented 6 years ago

highly recommended:c. add typora-default-lang in code @abnerlee It can save more tedious, faster writing.

yoo0 commented 6 years ago

Yes! If setting the default code language is possible, it would be more productive for programmers.

obar1 commented 6 years ago
LuckyMona commented 6 years ago

Totally agree with this suggestion. I am a javascript user, and really need this feature.

jaredellison commented 6 years ago

I too would love to see this feature implemented.

eryajf commented 5 years ago

When I was about to submit this question, I found that so many friends were already troubled by it. I, too, used shortcut keys to create a code block almost all the time in my daily writing, but every time I needed to define a language to color the code, the more I used it, the more uncomfortable I felt. I hope this problem with a long history can be solved as soon as possible!

AlexPasternak commented 5 years ago

I hope this problem with a long history can be solved as soon as possible!

Indeed we're now "celebrating" the 3-year anniversary (!) of when I raised this as an issue in https://github.com/typora/typora-issues/issues/184. Still no easy workaround for this outside of something like a Keyboard Maestro macro that expands the MD code block with a language of choice (like !cj for ```java).

eryajf commented 5 years ago

Haha, there is an old saying in China that "Great minds think alike". It suddenly occurred to me that we are so attached to the problem of code block coloring. In fact, it is because no color by default looks uncomfortable, because when I use other markdown tools, when I use shortcut keys to define a code block, it will be highlighted immediately. Even if it does not necessarily show the corresponding highlight according to the corresponding language, at least there is color display, which is also gratifying. I don't know if developers are willing to expend energy on this matter.

Still no easy workaround for this outside of something like a Keyboard Maestro macro that expands the MD code block with a language of choice (like !cj for ```java).

lunawen commented 5 years ago

Agree. I really hope typora can add this simple function so that I don't need to specify the programming language repeatedly in the same file.. which is quite annoying.

hello007 commented 4 years ago

Is there any update on this issue?

mehamednews commented 4 years ago

Any updates ?

feng-1985 commented 4 years ago

any updates ?

fskarmeta commented 4 years ago

any updates :D?

VeeVargas commented 3 years ago

Any updates on this issue?

fasoal commented 3 years ago

any updates ?

pycgo commented 3 years ago

why don't do it ??

4N7 commented 3 years ago

I would LOVE to see this feature. I really love Typora. Please? 🥺

ashish2199 commented 3 years ago

Why is it still not there yet :/

ProjectKitkat commented 3 years ago

Also interested! In my class, we're only using Java, so having to write ```java for every code block (I use around 5-10 per note; 1 note per lecture), is definitely a hassle.

alexxhenry commented 3 years ago

Bumping this. This is such a frustrating omission in an otherwise fantastic app. It's the only reason I keep an eye out for an alternative md editor.

ImAlien commented 3 years ago

hope to add this function

alexxhenry commented 3 years ago

Sick. Thank you!

On Aug 17, 2021, at 02:22, ImAlien @.***> wrote:

hope to add this function

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/typora/typora-issues/issues/290#issuecomment-900136870, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI23RJJP5GGAJ5CTJM2PDLT5IS53ANCNFSM4CPSJLSQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.

AlexPasternak commented 3 years ago

Happy belated 5th anniversary to this request. May it one day see the light of day.

darwinj07 commented 3 years ago

one day..

takamofu3n commented 2 years ago

wow, it has been 5 years? I'm new in programming but also wish to add this function

cmprmsd commented 2 years ago

Now that Typora isn't free any more I guess the need for this feature is gone for many people. I also switched to an alternative although I liked Typora's copy, paste and save image functionality. But sorry, not paying for this particular feature in closed source software. 😁

AlexPasternak commented 2 years ago

This is my first time hearing that Typora has exited beta and is now a paid product. I always said I would buy it, and registered for a license immediately. As a paid user, I still need and would like this feature, even if it's years later. This would be a huge "Finally" to take care of.

Raychanan commented 2 years ago

This is my first time hearing that Typora has exited beta and is now a paid product. I always said I would buy it, and registered for a license immediately. As a paid user, I still need and would like this feature, even if it's years later. This would be a huge "Finally" to take care of.

Found a way to get around with the shortcut app named "BetterTouchTool". My set up is that once typing shift+`, it automatically replaces with ```python + enter. This video might be helpful. https://www.youtube.com/watch?v=8C5C9yZlkWY image

alexxhenry commented 2 years ago

When this is implemented I'll buy a license.

yangpeiyi commented 2 years ago

Bump this up. Would LOVE this feature...

leeshakti commented 2 years ago

i am using an espanso shortcut

cmprmsd commented 2 years ago

i am using an espanso shortcut

Like to share? ;)

leeshakti commented 2 years ago

can be converted topython (or any other shortcut as per your convenience ) please install espanso - https://espanso.org/

anze03 commented 2 years ago

same problem ,looking forward to implemente this function

mcquiggd commented 2 years ago

Despite buying a licence for Typora, the lack of support for some features led me to switch to Obsidian. Not only is it free, it supports plugins, and the community is excellent. I have one that provides Git integration, and another plugin provides selection of default language when selecting and creating a code block (I have a couple of shortcuts assigned for csharp and js). Very customisable.

Recommended.

anton2020 commented 2 years ago

Any updates on this? Would be so happy to be able to set the code language just once...

6Fv commented 1 year ago

This has been a highly requested feature for 7 years. Any plans of implementing it? Thanks

If so… please consider existing documents (with existing code blocks) when creating this feature.