User Tools

Site Tools


format_code

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
format_code [2016/08/28 22:41] adminformat_code [2016/09/25 23:18] admin
Line 1: Line 1:
 [[resource]] [[resource]]
  
 +Often time, you will need to post a code here to for share. Here is how you can do it.
  
-<code php | code.php> +''%%<code lang title> some code </code>%%'' 
-if (!$lang) $lang = NULL; +
-// add one line +
-if (!trim($title) && $lang) $title = "Language: $lang"; +
-// end addition +
-} else {}+
  
 +Here is an example. 
 +
 +<code python | code.py>
 +def function(){
 +   print "hello, world!"
 +}
 </code>  </code> 
  
 +Here is the source line:
  
-<code cpp+''%%<code python | code.py
-div.code, div.file +def function()
-  width: 92%; +   print "hello, world!"
-  margin: 1em auto; +
-  border: 1px solid; +
-  padding: 4px;+
 } }
 +</code> %%''
 +
 +
 +If you want to disable the download,
 +''%%<code lang> some code </code>%%''
 +
 +
 +<code python>
 +def function2(){
 +   print "hello, python!"
 +}
 +</code>
 +
 +Here is the source line:
 +
 +''%%<code python>
 +def function2(){
 +   print "hello, python!"
 +}
 +</code>%%''
 +
 +For a very simple commend, try ''%%''code piece''%%''
 +
 +The advantage of using this is that you can include it in the sentence.  
 +
  
-</code>  
format_code.txt · Last modified: 2016/09/25 22:18 (external edit)