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

set default programming language for document

Open Bamieh opened this issue 9 years ago • 49 comments
trafficstars

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 "```".

Bamieh avatar Sep 14 '16 09:09 Bamieh

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.

AlexPasternak avatar Sep 14 '16 12:09 AlexPasternak

@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..

Bamieh avatar Sep 14 '16 12:09 Bamieh

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.

AlexPasternak avatar Sep 14 '16 13:09 AlexPasternak

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

toaco avatar Nov 25 '16 08:11 toaco

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

BluesChang avatar Nov 25 '16 08:11 BluesChang

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.

AlexPasternak avatar Nov 25 '16 18:11 AlexPasternak

+++

toaco avatar Feb 21 '17 13:02 toaco

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.

abnerlee avatar Feb 28 '17 14:02 abnerlee

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

toaco avatar Feb 28 '17 15:02 toaco

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

pzhaonet avatar Jun 22 '17 07:06 pzhaonet

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

richard1017 avatar Dec 28 '17 01:12 richard1017

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.

mlntr avatar Dec 28 '17 20:12 mlntr

Misspelling in the issue title: "lanauge".

vassudanagunta avatar Jan 19 '18 18:01 vassudanagunta

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

ouweiya avatar Feb 28 '18 08:02 ouweiya

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

yoo0 avatar Jun 24 '18 11:06 yoo0

  • #1639 related to this somehow

obar1 avatar Jul 25 '18 09:07 obar1

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

LuckyMona avatar Aug 03 '18 04:08 LuckyMona

I too would love to see this feature implemented.

jaredellison avatar Sep 18 '18 16:09 jaredellison

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!

eryajf avatar Jun 12 '19 13:06 eryajf

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).

AlexPasternak avatar Jun 12 '19 17:06 AlexPasternak

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).

eryajf avatar Jun 13 '19 01:06 eryajf

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.

lunawen avatar Aug 06 '19 01:08 lunawen

Is there any update on this issue?

hello007 avatar Mar 31 '20 08:03 hello007

Any updates ?

mehamednews avatar Apr 21 '20 19:04 mehamednews

any updates ?

feng-1985 avatar Aug 03 '20 00:08 feng-1985

any updates :D?

fskarmeta avatar Aug 26 '20 01:08 fskarmeta

Any updates on this issue?

VeeVargas avatar Oct 08 '20 03:10 VeeVargas

any updates ?

fasoal avatar Feb 23 '21 02:02 fasoal

why don't do it ??

pycgo avatar Mar 05 '21 09:03 pycgo

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

4N7 avatar Mar 05 '21 16:03 4N7