Help:Editing: Difference between revisions

From FreeCAD Documentation
(Created proper Example -> Result sections for the code block options.)
(Removed "In progress".)
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{TOCright}}
This page is a quick reference for Wikitext-code. A full help for [http://en.wikipedia.org/wiki/Help:Wiki_markup Wiki markup] can be found at Wikipedia.

== Introduction ==

This page is a quick reference for wikitext-code. A full help for [http://en.wikipedia.org/wiki/Help:Wiki_markup Wiki markup] can be found at Wikipedia.


[[WikiPages]] gives common guidelines on the best practices to be followed when writing FreeCAD documentation.
[[WikiPages]] gives common guidelines on the best practices to be followed when writing FreeCAD documentation.

----
This Editing Overview has a lot of '''wikitext''' examples. You may want to keep this page open in a separate browser window for reference while you edit.
This Editing Overview has a lot of '''wikitext''' examples. You may want to keep this page open in a separate browser window for reference while you edit.


== Editing basics ==
== Editing basics ==

;Start editing
;Start editing
:To start editing a MediaWiki page, click the '''Edit this page''' (or just '''edit''') link at one of its edges. This brings you to the '''edit page''': a page with a text box containing the ''[[wikipedia:wikitext|wikitext]]'': the editable source code from which the server produces the webpage. ''If you just want to experiment, please do so in the [[FreeCADDocu:Sandbox|sandbox]], not here''.
:To start editing a MediaWiki page, click the '''Edit''' link at the top of the page. This brings you to a page with a text box containing the [[wikipedia:wikitext|wikitext]]: the editable source code from which the server produces the webpage. ''If you just want to experiment, please do so in the [[FreeCADDocu:Sandbox|sandbox]], not here''.


;Type your changes
;Type your changes
:You can just type your text. However, also using basic wiki markup (described in the next section) to make links and do simple formatting adds to the value of your contribution.
:You can just type your text. However, also using basic wiki markup (described in the next section) and adding links adds to the value of your contribution.


;Summarize your changes
;Summarize your changes
:Write a short edit summary in the small field below the edit-box. You may use shorthand to describe your changes, as described in the legend.
:Write a short edit summary in the small field below the edit-box. You may use shorthand to describe your changes, as described in the legend.


;Download images
;Upload images
:You can also import your images, screenshots. . . from the page, bottom left "Toolbox". You will be asked for a file name and a brief description of the imported file.
:You can also add images and screenshots. Please only [[Special:Upload|upload]] {{FileName|*.png}} and {{FileName|*.svg}} files.

:Download images in free formats .png [https://www.gimp.org/ (example with Gimp)] and .svg [https://inkscape.org/ (example with Inkscape)]


;Preview before saving
;Preview before saving
:When you have finished, click '''Show preview''' to see how your changes will look -- '''before''' you make them permanent. Repeat the edit/preview process until you are satisfied, then click '''Save page''' and your changes will be immediately applied to the article.
:When you have finished, click the {{Button|Show preview}} button to see how your changes will look before making them permanent. Repeat the edit/preview process until you are satisfied, then click the {{Button|Save page}} button. Your changes will be applied to the page immediately.


:You can also use the links of the tools in the form of {{KEY|[[Workbench_KEY|Buttons]]}} or, in the form of [[Workbench_ICON|Icons]].

<br style="clear:all" />
=== Basic text formatting ===
=== Basic text formatting ===

{| {{prettytable}} width="100%" border="1" cellpadding="2" cellspacing="0"
{|{{prettytable}} width="100%"
|-
!style="width:50%;"|What you type
!What it looks like
!style="width:50%;"|What it looks like
!What you type

|-
|-
|
|
<pre>
You can ''italicize text'' by putting 2
apostrophes on each side.
You can ''italicize text'' by putting 2 apostrophes on each side.


3 apostrophes will bold '''the text'''.
3 apostrophes will bold '''the text'''.


5 apostrophes will bold and italicise
5 apostrophes will bold and italicise '''''the text'''''.
'''''the text'''''.


(4 apostrophes don't do anything special -- there's just ''''one left over''''.)
4 apostrophes don't do anything special, there's just
''''one left over''''.
|<pre>
</pre>
You can ''italicize text'' by putting 2
|
apostrophes on each side.
You can ''italicize text'' by putting 2 apostrophes on each side.


3 apostrophes will bold '''the text'''.
3 apostrophes will bold '''the text'''.


5 apostrophes will bold and italicize
5 apostrophes will bold and italicise '''''the text'''''.

'''''the text'''''.
4 apostrophes don't do anything special, there's just
''''one left over''''.


(4 apostrophes don't do anything special
-- there's just ''''one left over''''.)
</pre>
|-
|-
|
|
<pre>
A single newline
A single newline
has no effect
has no effect
on the layout.
on the layout.
But an empty line


But an empty line
starts a new paragraph.
starts a new paragraph.
|<pre>
</pre>
|
A single newline
A single newline
has no effect
has no effect
on the layout.
on the layout.

But an empty line
But an empty line

starts a new paragraph.
starts a new paragraph.

</pre>
|-
|-
|
|
<pre>
You can break lines<br />
without a new paragraph.<br />
You can break lines<br>
without a new paragraph.<br>
Please use this sparingly.
|<pre>
You can break lines<br />
without a new paragraph.<br />
Please use this sparingly.
Please use this sparingly.
</pre>
</pre>
|
You can break lines<br>
without a new paragraph.<br>
Please use this sparingly.

|-
|-
|
|
<pre>
You should "sign" your comments on talk pages: <br />
You should sign your comments on talk pages:<br>
- Three tildes gives your user name: [[User:xorx|Dr. Schorsch]] <br />
- Four tildes give your user name plus date/time: [[User:xorx|Dr. Schorsch]] 20:55, 1 November 2006 (CET)<br />
- Three tildes gives your user name: ~~~<br>
- Five tildes gives the date/time alone: 21:01, 1 November 2006 (CET)<br />
- Four tildes give your user name plus date/time: ~~~~<br>
- Five tildes gives the date/time only: ~~~~~<br>
|<pre>
You should "sign" your comments
on talk pages: <br />
- Three tildes gives your user
name: ~~~ <br />
- Four tildes give your user
name plus date/time: ~~~~ <br />
- Five tildes gives the
date/time alone: ~~~~~ <br />
</pre>
</pre>
|
You should sign your comments on talk pages:<br>
- Three tildes gives your user name: [[User:xorx|Dr. Schorsch]]<br>
- Four tildes give your user name plus date/time: [[User:xorx|Dr. Schorsch]] 20:55, 1 November 2006 (CET)<br>
- Five tildes gives the date/time only: 21:01, 1 November 2006 (CET)<br>

|-
|-
|
|
<pre>
You can use <b>HTML tags</b>, too, if you
You can use <b>HTML tags</b>, too. For example:
want. Some useful ways to use HTML:


Put text in a <tt>typewriter font</tt>. The same
Put text in a <tt>typewriter font</tt>. The same
font is generally used for <code>computer code</code>.
font is generally used for <code>computer code</code>.


<strike>Strike out</strike> or <u>underline</u>text,
<strike>Strike out</strike> or <u>underline</u> text,
or write it <span style="font-variant:small-caps">
or write it in <span style="font-variant:small-caps">
in small caps</span>.
small caps</span>.


Superscripts and subscripts:
Superscripts and subscripts:
Line 116: Line 118:


If you wish to make comments to the public,
If you wish to make comments to the public,
you should usually go on the [[wikipedia:wikipedia:talk page|talk page]], though.
you should go to the [[wikipedia:wikipedia:talk page|talk page]].
|<pre>
</pre>
|
You can use <b>HTML tags</b>,
You can use <b>HTML tags</b>, too. For example:
too, if you want. Some useful
ways to use HTML:


Put text in a <tt>typewriter
Put text in a <tt>typewriter font</tt>. The same
font is generally used for <code>computer code</code>.
font</tt>. The same font is
generally used for <code>
computer code</code>.


<strike>Strike out</strike>
<strike>Strike out</strike> or <u>underline</u> text,
or write it in <span style="font-variant:small-caps">
or <u>underline</u> text,
or write it <span style=
small caps</span>.
"font-variant:small-caps">
in small caps</span>.


Superscripts and subscripts:
Superscripts and subscripts:
X<sup>2</sup>, H<sub>2</sub>O
X<sup>2</sup>, H<sub>2</sub>O


Invisible comments to editors (&amp;lt;!-- --&amp;gt;)
Invisible comments to editors (&lt;!-- --&gt;)
only appear while editing the page.
only appear while editing the page.
<!-- Note to editors: blah blah blah. -->
<!-- Note to editors: blah blah blah. -->


If you wish to make comments to the public,
If you wish to make comments to the public,
you should usually go on the
you should go to the [[wikipedia:wikipedia:talk page|talk page]].
[[wikipedia:wikipedia:talk page|talk page]], though.
</pre>
|}
|}


For a list of HTML tags that are allowed, see [[Wikipedia:Help:HTML in wikitext|HTML in wikitext]]. However, you should avoid HTML in favor of Wiki markup whenever possible.
For a list of HTML tags that are allowed, see [[Wikipedia:Help:HTML in wikitext|HTML in wikitext]]. However, you should avoid HTML in favor of wiki markup whenever possible.


=== Organizing your writing ===
=== Organizing your writing ===

{| {{prettytable}} width="100%" border="1" cellpadding="2" cellspacing="0"
{|{{prettytable}} width="100%"
|-
!style="width:50%;"|What you type
!What it looks like
!style="width:50%;"|What it looks like
!What you type

|-
|-
|
|
<pre>
<div style="font-size:150%;border-bottom:1px solid #000000;">Section headings</div>
== H2 heading ==


Adding pairs of equals signs around a text creates a heading for a new
''Headings'' organize your writing into sections.
paragraph. You should start with 2 pairs of equals signs because using
The Wiki software can automatically generate
1 pair would create an H1 heading which is reserved for the page title.
a table of contents from them.


=== H3 heading ===
<div style="font-size:132%;font-weight:bold;">Subsection</div>
Using more equals signs creates a subsection.


Do not skip levels, for example do not go from 2 to 4 pairs of
<div style="font-size:116%;font-weight:bold;">A smaller subsection</div>
equals signs.
</pre>
|
{{Fake heading|sub=2|H2 heading}}
Adding pairs of equals signs around a text creates a heading for a new
paragraph. You should start with 2 pairs of equals signs because using
1 pair would create an H1 heading which is reserved for the page title.


{{Fake heading|sub=3|H3 heading}}
Don't skip levels, like from two to four equals signs.
Do not skip levels, for example do not go from 2 to 4 pairs of
equals signs.


Start with 2 equals signs not 1 because 1 creates H1 tags which should be reserved for page title.
|<pre>
== Subsection ==
Using more equals signs creates a subsection.

=== A smaller subsection ===
</pre>
|-
|-
|
|
<pre>
===External links===
=== External links ===
You will often want to make clickable ''links'' to other pages.


You will often want to make clickable links to other pages.
Here's a link to a page named [[Compile on Linux/Unix]].

You can not say [[compileonunix]] but
[[Compile on Linux/Unix]]es and the link will
Here's a link to a page named [[Compile_on_Linux|Compile on Linux]].
[[Compile on Linux]] will also work. But the first example is preferred.
show up correctly.
|<pre>
Here's a link to a page named [[Compile on Linux/Unix]].
You can not say [[compileonunix]] but
[[Compile on Linux/Unix]]es and the link will
show up correctly.
</pre>
</pre>
|

=== External links ===

You will often want to make clickable links to other pages.

Here's a link to a page named [[Compile_on_Linux|Compile on Linux]].
[[Compile on Linux]] will also work. But the first example is preferred.

|-
|-
|
|
<pre>
You can put formatting around a link.
You can put formatting around a link.
Example: ''[[Compile on Linux/Unix]]''.
Example: ''[[Compile_on_Linux|Compile on Linux]]''.
|<pre>
You can put formatting around a link.
Example: ''[[Compile on Linux/Unix]]''.
</pre>
</pre>
|
You can put formatting around a link.
Example: ''[[Compile_on_Linux|Compile on Linux]]''.

|-
|-
|
|
<pre>
The ''first letter'' of articles is automatically
The first letter of pages is automatically capitalized,
capitalized, so [[Compile on Linux/Unix]] goes to the same place
as [[compile on Linux/Unix]]. Capitalization matters after the
so [[Compile on Linux]] goes to the same place as
[[compile on Linux]]. Capitalization matters after the
first letter.
|<pre>
The ''first letter'' of articles is automatically
capitalized, so [[Compile on Linux/Unix]] goes to the same place
as [[compile on Linux/Unix]]. Capitalization matters after the
first letter.
first letter.
</pre>
</pre>
|
The first letter of pages is automatically capitalized,
so [[Compile on Linux]] goes to the same place as
[[compile on Linux]]. Capitalization matters after the
first letter.

|-
|-
|
|
<pre>
[[The weather in Riga]] is a page that doesn't exist
[[The_weather_in_Riga|The weather in Riga]] is a page that
yet. You could create it by clicking on the link.
doesn't exist yet. You could create it by clicking on the
|<pre>
link.
[[The weather in Riga]] is a page that doesn't exist
yet. You could create it by clicking on the link.
</pre>
</pre>
|
[[The_weather_in_Riga|The weather in Riga]] is a page that
doesn't exist yet. You could create it by clicking on the
link.

|-
|-
|
|
<pre>
You can link to a page section by its heading:
You can link to a page section by its heading:<br>

*[[Help:Editing#Organizing your writing]].
[[Help:Editing#Organizing_your_ writing|Organizing your writing]].

If multiple sections have the same heading, add
a number. [[#Example section 3]] goes to the
third section named "Example section".
|<pre>
You can link to a page section by its heading:

*[[Help:Editing#Organizing your writing]].


If multiple sections have the same heading, add
If the section is on the same page you should leave out the
page name:<br>
a number. [[#Example section 3]] goes to the
[[#Organizing_your_ writing|Organizing your writing]].
third section named "Example section".
</pre>
</pre>
|-
|
|
You can make a link point to a different place
You can link to a page section by its heading:<br>
[[Help:Editing#Organizing_your_ writing|Organizing your writing]].
with a piped link. Put the link
target first, then the pipe character "|", then
the link text.


If the section is on the same page you should leave out the
*[[Compile on Linux/Unix|Compile on Linux/Unix]]
page name:<br>
|<pre>
[[#Organizing_your_ writing|Organizing your writing]].
You can make a link point to a different place
with a piped link. Put the link
target first, then the pipe character "|", then
the link text.


*[[Compile on Linux/Unix|Compile on Linux/Unix]]
</pre>
|-
|-
|
|
<pre>
You can make a link to Wikipedia by typing:
You can make a link to Wikipedia by typing:<br>
[[wikipedia:Python (programming language)]]
[[wikipedia:Python (programming language)]]


You can make an external link just by typing a URL:
You can make an external link by just typing a URL:<br>
http://www.nupedia.com
http://www.nupedia.com


You can give it a title:
You can give it a title:<br>
[http://www.nupedia.com Nupedia]
[http://www.nupedia.com Nupedia]


Or leave the title blank:
Or leave the title blank:<br>
[http://www.nupedia.com]
[http://www.nupedia.com]
</pre>
|
|
You can make a link to Wikipedia by typing:<br>
<pre>
You can make a link to Wikipedia by typing:
[[wikipedia:Python (programming language)]]
[[wikipedia:Python (programming language)]]


You can make an external link just by typing a URL:
You can make an external link by just typing a URL:<br>
http://www.nupedia.com
http://www.nupedia.com


You can give it a title:
You can give it a title:<br>
[http://www.nupedia.com Nupedia]
[http://www.nupedia.com Nupedia]


Or leave the title blank:
Or leave the title blank:<br>
[http://www.nupedia.com]
[http://www.nupedia.com]

</pre>
|-
|-
|
Linking to an e-mail address works the same way:
mailto:someone@domain.com or
[mailto:someone@domain.com someone]
|
|
<pre>
<pre>
Linking to an e-mail address works the same way:
Linking to an e-mail address works the same way:<br>
mailto:someone@domain.com or
mailto:someone@domain.com

Or:<br>
[mailto:someone@domain.com someone]
[mailto:someone@domain.com someone]
</pre>
</pre>
|
Linking to an e-mail address works the same way:<br>
mailto:someone@domain.com

Or:<br>
[mailto:someone@domain.com someone]

|-
|-
|
|
<pre>
You can redirect the user to another page.
#REDIRECT [[Target page name]]
|<pre>
#REDIRECT [[Official position]]
</pre>
</pre>
|
You can redirect the user to another page.

|-
|-
|
|
<pre>
To put an article in a [http://en.wikipedia.org/wiki/Wikipedia:Categorization category],
To put a page in a [http://en.wikipedia.org/wiki/Wikipedia:Categorization category],
place a link like Category:Help into the article.
Category links do not show up in line
add a link like Category:Help. Category links do not show up
but at page bottom ''and cause the page to be''
inline but at page bottom. They cause the page to be listed
''listed in the category.''
in the linked category:<br>
[[Category:Help]]
[[Category:Help]]


To link to a category page without putting the article
To link to a category page without putting the article
into the category, use a colon prefix (":Category")
into the category, use a colon prefix in the link:<br>
in the link. [[:Category:Help]]
[[:Category:Help]]
|<pre>
</pre>
|
To put an article in a category,
To put a page in a [http://en.wikipedia.org/wiki/Wikipedia:Categorization category],
place a link like Category:Help into the article.
Category links do not show up in line
add a link like Category:Help. Category links do not show up
but at page bottom ''and cause the page to be''
inline but at page bottom. They cause the page to be listed
''listed in the category.''
in the linked category:<br>
[[Category:Help]]
[[Category:Help]]


To link to a category page without putting the article
To link to a category page without putting the article
into the category, use a colon prefix (":Category")
into the category, use a colon prefix in the link:<br>
in the link. [[:Category:Help]]
[[:Category:Help]]
</pre>


|-
|-
|
|
<pre>
You can include pictures [[Image:Base_ExampleCommandModel.png]]. You can refer to [http://www.mediawiki.org/wiki/Help:Images MediaWiki Images Help] for details about the possible options. A very useful one is 'none', allowing your picture to be positioned on the left, with no flowing text:
You can include images: [[Image:Freecad.svg|24px]]. You can refer to
[[Image:Base_ExampleCommandModel.png|none]]
[http://www.mediawiki.org/wiki/Help:Images MediaWiki Images Help]

for details about the available options. A very useful one is
|<pre>
<code>none</code>, allowing your image to be positioned on the
You can include pictures [[Image:Base_ExampleCommandModel.png]].
left, with no flowing text:
You can refer to [http://www.mediawiki.org/wiki/Help:
[[Image:Freecad.svg|none]]
Images MediaWiki Images Help] for details about the possible
options. A very useful one is 'none', allowing your picture to
be positioned on the left, with no flowing text:
[[Image:Base_ExampleCommandModel.png|none]]
</pre>
</pre>
|
You can include images: [[Image:Freecad.svg|24px]]. You can refer to
[http://www.mediawiki.org/wiki/Help:Images MediaWiki Images Help]
for details about the available options. A very useful one is
<code>none</code>, allowing your image to be positioned on the
left, with no flowing text:
[[Image:Freecad.svg|none]]


|-
|-
|
|
<pre>
You can use ordered or unordered lists:
You can use ordered or unordered lists:


Line 350: Line 356:
** Sub-item 1.2
** Sub-item 1.2
* Item2
* Item2
</pre>

|
|<pre>
You can use ordered or unordered lists:
You can use ordered or unordered lists:


Line 365: Line 371:
** Sub-item 1.2
** Sub-item 1.2
* Item2
* Item2
</pre>
|}
|}


==Collapsible element==
== Collapsible element ==


===Collapsible element complete page===
=== Collapsible element complete page ===


<div class="mw-collapsible mw-collapsed toccolours">
<div class="mw-collapsible mw-collapsed toccolours">
===Click to see the code===
=== Click to see the code ===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


Line 381: Line 386:


<nowiki>
<nowiki>
===Your Title===
=== Your Title ===
</nowiki>
</nowiki>


Line 388: Line 393:
</nowiki>
</nowiki>


Your text and image [[Image:Base_ExampleCommandModel.png|16px]] FreeCAD.
Your text and image [[Image:Freecad.svg|24px]] FreeCAD.


<nowiki>
<nowiki>
Line 401: Line 406:
</div>
</div>


=== Collapsible element 500 pixels ===

===Collapsible element 500 pixels===


<div class="mw-collapsible mw-collapsed toccolours" style="width:500px">
<div class="mw-collapsible mw-collapsed toccolours" style="width:500px">
===Click to see the code===
=== Click to see the code ===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">


Line 413: Line 417:


<nowiki>
<nowiki>
===Your Title===
=== Your Title ===
</nowiki>
</nowiki>


Line 420: Line 424:
</nowiki>
</nowiki>


Your text and image [[Image:Base_ExampleCommandModel.png|16px]] FreeCAD.
Your text and image [[Image:Freecad.svg|24px]] FreeCAD.


<nowiki>
<nowiki>
Line 435: Line 439:
==Code blocks and syntax highlighting==
==Code blocks and syntax highlighting==


To mark a code block a number of solutions are available. The Code template is the preferred solution.
To mark a code block a number of solutions are available. The [[#Use_the_Code_template|Code template]] is the preferred solution.


===Prepend a space to each line===
===Prepend a space to each line===
Line 443: Line 447:
<nowiki>
<nowiki>
import math
import math
for radius in [1.0, 2.0, 3.0]:
from pivy import coin
area = math.pi * pow(radius, 2)
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
print(area)</nowiki>
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))
</nowiki>


Result:
Result:


import math
import math
for radius in [1.0, 2.0, 3.0]:
from pivy import coin
area = math.pi * pow(radius, 2)
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
print(area)
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))


===Use <nowiki><pre></nowiki> tags===
===Use <nowiki><pre></nowiki> tags===
Line 466: Line 465:
<pre>
<pre>
import math
import math
for radius in [1.0, 2.0, 3.0]:
from pivy import coin
area = math.pi * pow(radius, 2)
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
print(area)
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))
</pre></nowiki>
</pre></nowiki>


Line 477: Line 474:
<pre>
<pre>
import math
import math
for radius in [1.0, 2.0, 3.0]:
from pivy import coin
area = math.pi * pow(radius, 2)
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
print(area)
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))
</pre>
</pre>


===Use <nowiki><syntaxhighlight></nowiki> tags===
===Use <nowiki><syntaxhighlight></nowiki> tags===


These tags will highlight the syntax. The '''lang''' parameter is required.
As the name implies, these tags will highlight the syntax. The {{Incode|lang}} parameter is required.


Example:
Example:
Line 493: Line 488:
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
import math
import math
for radius in [1.0, 2.0, 3.0]:
from pivy import coin
area = math.pi * pow(radius, 2)
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
print(area)
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))
</syntaxhighlight></nowiki>
</syntaxhighlight></nowiki>


Line 504: Line 497:
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
import math
import math
for radius in [1.0, 2.0, 3.0]:
from pivy import coin
area = math.pi * pow(radius, 2)
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
print(area)
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))
</syntaxhighlight>
</syntaxhighlight>


===Use the Code template===
===Use the Code template===


The Code template will highlight the syntax. If the language is Python the '''lang''' parameter is optional.
The Code template will also highlight the syntax. If the language is Python the {{Incode|lang}} parameter is optional.


Example:
Example:
Line 520: Line 511:
{{Code|lang=python|code=
{{Code|lang=python|code=
import math
import math
for radius in [1.0, 2.0, 3.0]:
from pivy import coin
area = math.pi * pow(radius, 2)
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
print(area)
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))
}}</nowiki>
}}</nowiki>


Line 531: Line 520:
{{Code|lang=python|code=
{{Code|lang=python|code=
import math
import math
for radius in [1.0, 2.0, 3.0]:
from pivy import coin
area = math.pi * pow(radius, 2)
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
print(area)
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))
}}
}}


Line 555: Line 542:
'''Remark''': if a page is transcluded without any transclusion markup, it may cause an unintentional [http://en.wikipedia.org/wiki/Wikipedia:Categorization categorization]. Any page transcluding it will contain the same category as the original page. Wrap the category markup with '''<nowiki><noinclude></nowiki>''' tags to prevent incorrect categorization.
'''Remark''': if a page is transcluded without any transclusion markup, it may cause an unintentional [http://en.wikipedia.org/wiki/Wikipedia:Categorization categorization]. Any page transcluding it will contain the same category as the original page. Wrap the category markup with '''<nowiki><noinclude></nowiki>''' tags to prevent incorrect categorization.


{| {{prettytable}} width="100%" border="1" cellpadding="2" cellspacing="0"
{|{{prettytable}} width="100%"
|-
!What it looks like
!What you type
!What you type
!What it looks like

|-
|-
|
|
<pre>
{{Transclusion demo}}
{{Transclusion demo}}
|<nowiki>
</pre>
|
{{Transclusion demo}}
{{Transclusion demo}}

</nowiki>
|-
|-
|
|
<pre>
{{Help:Transclusion demo}}
{{Help:Transclusion demo}}
|<nowiki>
</pre>
|
{{Help:Transclusion demo}}
{{Help:Transclusion demo}}
</nowiki>
|}
|}


Line 588: Line 578:


Marking a significant change as a minor edit is considered bad Wikiquette. If you have accidentally marked an edit as minor, make a dummy edit, verify that the "<small>'''[&nbsp;] This is a minor edit'''</small>" check-box is unchecked, and explain in the edit summary that the previous edit was not minor.
Marking a significant change as a minor edit is considered bad Wikiquette. If you have accidentally marked an edit as minor, make a dummy edit, verify that the "<small>'''[&nbsp;] This is a minor edit'''</small>" check-box is unchecked, and explain in the edit summary that the previous edit was not minor.

== Translations ==
{{languages | {{fr|Help:Editing/fr}} {{it|Help:Editing/it}} }}

Latest revision as of 08:13, 6 August 2021

Introduction

This page is a quick reference for wikitext-code. A full help for Wiki markup can be found at Wikipedia.

WikiPages gives common guidelines on the best practices to be followed when writing FreeCAD documentation.

This Editing Overview has a lot of wikitext examples. You may want to keep this page open in a separate browser window for reference while you edit.

Editing basics

Start editing
To start editing a MediaWiki page, click the Edit link at the top of the page. This brings you to a page with a text box containing the wikitext: the editable source code from which the server produces the webpage. If you just want to experiment, please do so in the sandbox, not here.
Type your changes
You can just type your text. However, also using basic wiki markup (described in the next section) and adding links adds to the value of your contribution.
Summarize your changes
Write a short edit summary in the small field below the edit-box. You may use shorthand to describe your changes, as described in the legend.
Upload images
You can also add images and screenshots. Please only upload *.png and *.svg files.
Preview before saving
When you have finished, click the Show preview button to see how your changes will look before making them permanent. Repeat the edit/preview process until you are satisfied, then click the Save page button. Your changes will be applied to the page immediately.

Basic text formatting

What you type What it looks like
You can ''italicize text'' by putting 2 apostrophes on each side. 

3 apostrophes will bold '''the text'''. 

5 apostrophes will bold and italicise '''''the text'''''.

4 apostrophes don't do anything special, there's just
''''one left over''''.

You can italicize text by putting 2 apostrophes on each side.

3 apostrophes will bold the text.

5 apostrophes will bold and italicise the text.

4 apostrophes don't do anything special, there's just 'one left over'.

A single newline
has no effect
on the layout.

But an empty line
starts a new paragraph.

A single newline has no effect on the layout.

But an empty line starts a new paragraph.

You can break lines<br>
without a new paragraph.<br>
Please use this sparingly.

You can break lines
without a new paragraph.
Please use this sparingly.

You should sign your comments on talk pages:<br>
- Three tildes gives your user name: ~~~<br>
- Four tildes give your user name plus date/time: ~~~~<br>
- Five tildes gives the date/time only: ~~~~~<br>

You should sign your comments on talk pages:
- Three tildes gives your user name: Dr. Schorsch
- Four tildes give your user name plus date/time: Dr. Schorsch 20:55, 1 November 2006 (CET)
- Five tildes gives the date/time only: 21:01, 1 November 2006 (CET)

You can use <b>HTML tags</b>, too. For example:

Put text in a <tt>typewriter font</tt>. The same
font is generally used for <code>computer code</code>.

<strike>Strike out</strike> or <u>underline</u> text,
or write it in <span style="font-variant:small-caps">
small caps</span>.

Superscripts and subscripts:
X<sup>2</sup>, H<sub>2</sub>O

Invisible comments to editors (<!-- -->) 
only appear while editing the page.
<!-- Note to editors: blah blah blah. -->

If you wish to make comments to the public, 
you should go to the [[wikipedia:wikipedia:talk page|talk page]].

You can use HTML tags, too. For example:

Put text in a typewriter font. The same font is generally used for computer code.

Strike out or underline text, or write it in small caps.

Superscripts and subscripts: X2, H2O

Invisible comments to editors (<!-- -->) only appear while editing the page.

If you wish to make comments to the public, you should go to the talk page.

For a list of HTML tags that are allowed, see HTML in wikitext. However, you should avoid HTML in favor of wiki markup whenever possible.

Organizing your writing

What you type What it looks like
== H2 heading ==

Adding pairs of equals signs around a text creates a heading for a new
paragraph. You should start with 2 pairs of equals signs because using
1 pair would create an H1 heading which is reserved for the page title.

=== H3 heading ===

Do not skip levels, for example do not go from 2 to 4 pairs of
equals signs.
H2 heading

Adding pairs of equals signs around a text creates a heading for a new paragraph. You should start with 2 pairs of equals signs because using 1 pair would create an H1 heading which is reserved for the page title.

H3 heading

Do not skip levels, for example do not go from 2 to 4 pairs of equals signs.

=== External links ===

You will often want to make clickable links to other pages.

Here's a link to a page named [[Compile_on_Linux|Compile on Linux]].
[[Compile on Linux]] will also work. But the first example is preferred.

External links

You will often want to make clickable links to other pages.

Here's a link to a page named Compile on Linux. Compile on Linux will also work. But the first example is preferred.

You can put formatting around a link.
Example: ''[[Compile_on_Linux|Compile on Linux]]''.

You can put formatting around a link. Example: Compile on Linux.

The first letter of pages is automatically capitalized,
so [[Compile on Linux]] goes to the same place as
[[compile on Linux]]. Capitalization matters after the
first letter.

The first letter of pages is automatically capitalized, so Compile on Linux goes to the same place as compile on Linux. Capitalization matters after the first letter.

[[The_weather_in_Riga|The weather in Riga]] is a page that
doesn't exist yet. You could create it by clicking on the
link.

The weather in Riga is a page that doesn't exist yet. You could create it by clicking on the link.

You can link to a page section by its heading:<br>
[[Help:Editing#Organizing_your_ writing|Organizing your writing]].

If the section is on the same page you should leave out the
page name:<br>
[[#Organizing_your_ writing|Organizing your writing]].

You can link to a page section by its heading:
Organizing your writing.

If the section is on the same page you should leave out the page name:
Organizing your writing.

You can make a link to Wikipedia by typing:<br>
[[wikipedia:Python (programming language)]]

You can make an external link by just typing a URL:<br>
http://www.nupedia.com

You can give it a title:<br>
[http://www.nupedia.com Nupedia]

Or leave the title blank:<br>
[http://www.nupedia.com]

You can make a link to Wikipedia by typing:
wikipedia:Python (programming language)

You can make an external link by just typing a URL:
http://www.nupedia.com

You can give it a title:
Nupedia

Or leave the title blank:
[1]

Linking to an e-mail address works the same way:<br>
mailto:someone@domain.com

Or:<br>
[mailto:someone@domain.com someone]

Linking to an e-mail address works the same way:
mailto:someone@domain.com

Or:
someone

#REDIRECT [[Target page name]]

You can redirect the user to another page.

To put a page in a [http://en.wikipedia.org/wiki/Wikipedia:Categorization category], 
add a link like Category:Help. Category links do not show up
inline but at page bottom. They cause the page to be listed
in the linked category:<br>
[[Category:Help]]

To link to a category page without putting the article
into the category, use a colon prefix in the link:<br>
[[:Category:Help]]

To put a page in a category, add a link like Category:Help. Category links do not show up inline but at page bottom. They cause the page to be listed in the linked category:

To link to a category page without putting the article into the category, use a colon prefix in the link:
Category:Help

You can include images: [[Image:Freecad.svg|24px]]. You can refer to
[http://www.mediawiki.org/wiki/Help:Images MediaWiki Images Help]
for details about the available options. A very useful one is
<code>none</code>, allowing your image to be positioned on the
left, with no flowing text:
[[Image:Freecad.svg|none]]

You can include images: . You can refer to MediaWiki Images Help for details about the available options. A very useful one is none, allowing your image to be positioned on the left, with no flowing text:

You can use ordered or unordered lists:

# Item1
## Sub-item 1.1
### Sub-item 1.1.1
## Sub-item 1.2
# Item2

* Item1
** Sub-item 1.1
*** Sub-item 1.1.1
** Sub-item 1.2
* Item2

You can use ordered or unordered lists:

  1. Item1
    1. Sub-item 1.1
      1. Sub-item 1.1.1
    2. Sub-item 1.2
  2. Item2
  • Item1
    • Sub-item 1.1
      • Sub-item 1.1.1
    • Sub-item 1.2
  • Item2

Collapsible element

Collapsible element complete page

Click to see the code

<div class="mw-collapsible mw-collapsed toccolours">

=== Your Title ===

<div class="mw-collapsible-content">

Your text and image FreeCAD.

</div>

</div>

Collapsible element 500 pixels

Click to see the code

<div class="mw-collapsible mw-collapsed toccolours" style="width:500px">

=== Your Title ===

<div class="mw-collapsible-content">

Your text and image FreeCAD.

</div>

</div>

Code blocks and syntax highlighting

To mark a code block a number of solutions are available. The Code template is the preferred solution.

Prepend a space to each line

Example:

 import math
 for radius in [1.0, 2.0, 3.0]:
     area = math.pi * pow(radius, 2)
     print(area)

Result:

import math
for radius in [1.0, 2.0, 3.0]:
    area = math.pi * pow(radius, 2)
    print(area)

Use <pre> tags

Example:

<pre>
import math
for radius in [1.0, 2.0, 3.0]:
    area = math.pi * pow(radius, 2)
    print(area)
</pre>

Result:

import math
for radius in [1.0, 2.0, 3.0]:
    area = math.pi * pow(radius, 2)
    print(area)

Use <syntaxhighlight> tags

As the name implies, these tags will highlight the syntax. The lang parameter is required.

Example:

<syntaxhighlight lang="python">
import math
for radius in [1.0, 2.0, 3.0]:
    area = math.pi * pow(radius, 2)
    print(area)
</syntaxhighlight>

Result:

import math
for radius in [1.0, 2.0, 3.0]:
    area = math.pi * pow(radius, 2)
    print(area)

Use the Code template

The Code template will also highlight the syntax. If the language is Python the lang parameter is optional.

Example:

{{Code|lang=python|code=
import math
for radius in [1.0, 2.0, 3.0]:
    area = math.pi * pow(radius, 2)
    print(area)
}}

Result:

import math
for radius in [1.0, 2.0, 3.0]:
    area = math.pi * pow(radius, 2)
    print(area)

Templates and transcluding pages

Templates are segments of wiki markup that are meant to be copied automatically ("transcluded") into a page. You add them by putting the template's name in {{double braces}}. By default, pages are transcluded from the default Template namespace. The namespace is the portion of a page name before the colon; for instance, in Help:Editing, Help is the namespace in which the page Editing lives.

It is also possible to transclude other pages from the default namespace (the null one) by using {{:colon and double braces}}.

There are three pairs of transclusion markup tags that can be used in wikitext to control how transclusion affects parts of a template or article. They determine whether or not wikitext renders, either in its own article, which we will call "here", or in another article where it is transcluded, which we will call "there".

  • <noinclude>: the content will not be rendered there. These tags have no effect here.
  • <includeonly>: the content will render only there, and will not render here (like invisible ink made visible by means of transclusion).
  • <onlyinclude>: the content will render here and will render there, but it will only render there what is between these tags.

There can be several such section. Also, they can be nested.

Remark: if a page is transcluded without any transclusion markup, it may cause an unintentional categorization. Any page transcluding it will contain the same category as the original page. Wrap the category markup with <noinclude> tags to prevent incorrect categorization.

What you type What it looks like
{{Transclusion demo}}

This text comes from the page named Template:Transclusion demo. It has been transcluded into this page.


{{Help:Transclusion demo}}

This transclusion demo is a little bit of text from the page Help:Transclusion demo to be included into any file.

Special Pages

Special pages are pages that cannot be edited, but are generated by the wiki engine. They provide very useful functions, and live in the Special namespace. A summary of all special pages is available from Special:SpecialPages.

Direct link to frequently used Special pages are:

Minor edits

A logged-in user can mark an edit as "minor". Minor edits are generally spelling corrections, formatting, and minor rearrangement of text. Users may choose to hide minor edits when viewing Recent Changes.

Marking a significant change as a minor edit is considered bad Wikiquette. If you have accidentally marked an edit as minor, make a dummy edit, verify that the "[ ] This is a minor edit" check-box is unchecked, and explain in the edit summary that the previous edit was not minor.