Jump to content

Paste format: Difference between revisions

Sylveon (talk | contribs)
Add {{stub}} template while this page is being worked on
 
Sylveon (talk | contribs)
Initial draft
Line 1: Line 1:
{{stub}}
{{Page in progress}}The purpose of this article is to document how [[Main Page|Our World of Text's]] paste ''format'' works, which refers to the structure and composition of [[wikipedia:Unicode|Unicode characters]] produced by the built-in [https://wiki.ourworldoftext.com/wiki/Keybinds#Select_&_copy_a_region_of_text area selection tool].
 
<small>Note: This article does ''not'' document the pasting mechanic itself; for that information, see ''[[Pasting]]''.</small>
 
== Escape characters ==
With the exception of text decorations, all character attribute changes (i.e. links, colors) are prefixed by an '''escape character''' (<code>U+001B</code>), followed by an escape code. After an escape code is written, it must either be followed by a segment of text, '''or''' followed by another escape code. The list of all possible escape codes can be seen below.
 
=== Changing colors ===
<small>'''''Important''': For best performance, you may (optionally) write the escape codes listed below by each <u>change</u>, rather than by each character. This condition only applies for setting/resetting colors.''</small>
 
==== Text colors ====
To change the current text color, you'd write an escape character (<code>\x1B</code>), followed by the capital letter <code>F</code>, followed by a hex-encoded RGB value.
 
Example: To change the current text color to a pure green, you'd write the sequence <code>\x1BF00ff00</code>.
 
==== Cell colors ====
Changing the cell color works very similarly to changing the text color. The formatting begins with an escape character (<code>\x1B</code>), followed by the lowercase letter <code>b</code>, finally ending with a hex-encoded RGB value.
 
Example: To set the current background color to a pure magenta, you'd write the sequence <code>\x1Bbff00ff</code>.
 
==== Resetting colors ====
To reset the currently set color, you'd simply write an escape character (<code>\x1B</code>), immediately followed by the lowercase letter <code>x</code>. Keep in mind that this will reset '''all''' colors (including text and cell colors) to the default text color, as defined in the world's [https://wiki.ourworldoftext.com/wiki/World#World_Settings configuration settings].
 
=== Links & protections ===
<small>'''''Important''': The escape codes listed here must be applied to each <u>character</u> in a text.''</small>
 
In order to apply a link to some text, you first write an escape character (<code>\x1B</code>), then the characters <code>$u</code>, and ending with stringified text, '''including the quotes''', containing the contents of your link.
 
Example: If you wanted to apply the link <code><nowiki>http://owot.me</nowiki></code> to the text "<code>hi</code>", you would write <code>\x1B$u"<nowiki>http://a</nowiki>"h\x1B$u"<nowiki>http://a</nowiki>"i</code>.
 
=== Protections ===
To apply protections to some text, you start by writing an escape character (<code>\x1B</code>), followed by a '''protection value.'''  The protection value can be one of <code>P0</code> (public), <code>P1</code> (members-only), or <code>P2</code> (owner-only).
 
Example: To apply an owner-only protection to the text "sample", you'd write <code>\x1BP2s\x1BP2a\x1BP2m\x1BP2p\x1BP2l\x1BP2e</code>.
 
== Text decorations ==
Text decorations (such as bold, italics, underline, and strikethrough), are stored differently than colors & links. Instead of using escape codes, text decorations utilize [[wikipedia:Combining_Diacritical_Marks_for_Symbols|Unicode combining characters]] to store a single character's state. Unlike escape codes, combining characters ''succeed'' a character, rather than preceding it.
 
OWOT uses the Unicode code point range <code>U+20F1</code> to <code>U+20FF</code> to store text decorations. The specific code point to be used is determined by encoding a character's formatting in binary (offset by a hex value of <code>0x20F0</code>). The bit order for each decoration is the same as it appears on the [https://wiki.ourworldoftext.com/images/2/20/Text_decorations_menu_2024_03_24.png official client's text decorations menu], and setting a bit to <code>1</code> enables a decoration.
 
Example: If I wanted to make the character "A" appear bold and italicized, I would write <code>A\u20FC</code>.