Changes

Jump to navigation Jump to search
1,491 bytes added ,  12:37, 28 October 2021
The <code><nowiki><context> ... </context></nowiki></code> tags process their ConTeXt contents on the fly and include the result on the page as an image. Whitespace is cropped out. The following options are availableattributes may be set:
* <code>source="yes"</code> displays the source before the output.
* <code>text="some text"</code> places 'some text' between the source and the output.
* <code>mode="mkiv"</code> ensures forces [[Mark IV]] is used instead of the default Mark II[[LMTX]] (should not be needed except to demonstrate a documented difference)* <code>force="yes"</code> forces regeneration of the PNG image each time the page is loaded. This is expensive, so please only use it on special occasions (like in the example below where we are showing the {{cmd|contextbanner}}.
Quotation marks around attribute strings are only required if the attribute contains non-alphabetic characters.
The extension wraps your code with a bit of extra ConTeXt code to get a compilable file. There are two different
cases, depending on whether your code contains {{cmd|starttext}} ... {{cmd|stoptext}} or not.
 
With a starttext/stoptext block, the wrapping uses:
 
<texcode>
\setuppapersize[A5][A5]
\setupexternalfigures[location={local,default}]
\setupbodyfont[8pt]
\setupcolors[state=start]
.. your input here ..
</texcode>
 
and without starttext/stoptext, the extension uses:
 
<texcode>
\setuppapersize[A5][A5]
\setupexternalfigures[location={local,default}]
\setupbodyfont[8pt]
\setupcolors[state=start]
\starttext
\startTEXpage
.. your input here ..
\stopTEXpage
\stoptext
</texcode>
== Examples ==
\setupcolors [state=start]
\framed [background=color,
backgroundcolor=greengray,
offset=0.5cm ]{hello world!}
</context>
\setupcolors [state=start]
\framed [background=color,
backgroundcolor=greengray,
offset=0.5cm ]{hello world!}
</context>
|}
=== source="yes " ===
{| class=wikitable
\setupcolors [state=start]
\framed [background=color,
backgroundcolor=greengray,
offset=0,5cm ]{hello world!}
</context>
\setupcolors [state=start]
\framed [background=color,
backgroundcolor=greengray,
offset=0.5cm ]{hello world!}
</context>
|}
=== mode=mkii "mkiv" and mode=mkiv "lmtx" ===By default, the wiki compiles examples using [[LMTX]]. You can specify that you want to use MkIV by adding the option <tt>mode="mkiv"</tt> to the tag. Because MkIV examples are visually indistinguishable from LMTX examples, it is good practice to start MkIV examples with a comment <code>% mode=mkiv</code>.
{| class=wikitable
|- style="vertical-align: top"
| <xmlcode>
<context source="yes" force="yes">Version: \contextversionnumbercontextbanner
</context>
</xmlcode>
| <context source="yes" force="yes">Version: \contextversionnumbercontextbanner
</context>
|- style="vertical-align: top"
| <xmlcode>
<context mode="mkiv " source="yes" force="yes">
% mode=mkiv
Version: \contextversionnumbercontextbanner
</context>
</xmlcode>
|<context mode="mkiv " source="yes" force="yes">
% mode=mkiv
Version: \contextversionnumbercontextbanner
</context>
|}
\setuppaper[nx=2, ny=2] % arrange pages 2 by 2 (must come before \setuparranging[XY])
\setuparranging[XY] % arrange pages n by n (across, then down)
\setuppagenumbering[location=footer] % page numbers are always useful
\showframe[edge] % Draw line around each page. Prevents overzealous cropping
four
</context>
 
{{About this wiki navbox}}
 
[[Category:Help|Context]]
[[Category:Wiki-Maintenance]]

Navigation menu