E
E
esin2011-08-16 13:20:24
Habr
esin, 2011-08-16 13:20:24

How to beautifully insert code into an article on Habr?

Good afternoon everyone.
Recently wrote an article in the sandbox. This is my first article on Habré. It contains the code that I put in the "code" tag. But when previewing and after publishing, the code still looked like plain text. Can you tell me how to correctly insert the code into the article? Of course, I have an assumption that you need to use third-party editors, such as HabraEditor , but I hope that I screwed up somewhere, and you can get by with a local editor. Thank you!

Answer the question

In order to leave comments, you need to log in

5 answer(s)
P
pyJIoH, 2011-08-16
@esin

There is a natural mechanism - the source lang tag = "language_name"

D
Dmitry Zhiltsov, 2011-08-16
@zaabjuda

def BuildFileList(path, mask, flist):
  import os
  lPath = path
  lsFiles =  os.listdir(lPath)
  for f in lsFiles:
          fName = path + '\\' + f 
    if (os.path.isdir(fName)):
      BuildFileList(fName, mask, flist)
    else:
      if (fName.find(mask) >= 0):
        flist.append(fName)


and it looks like this pastebin.com/raw.php?i=61WDRBMX
I think it will be clear to you

I
Igor Petrov, 2011-08-16
@KriegeR

For example, there is such an option.
And if you want to show code that does not have to litter the place, then you can throw it here , and provide links in the article.

M
Maxim, 2011-08-16
@Maxim_ka

I used the tag when I copied the commands and their output from the console to the article, it retains all the columns and formatting. Try it instead.

C
ComputerPers, 2011-08-16
@ComputerPers

Does anyone know when the highlighting for PowerShell will be available? otherwise when I write the code, I have to use perl :-(

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question