**Language / Langue :** [[fr:yaml:texte|FR]] | **EN** ====== Text and Formatting (YAML) ====== ===== Line Breaks ===== In a YAML ''text: |'' block, line breaks are preserved. Use ''+n+'' for an explicit line break in formats that do not support real new lines. ===== Text Box ===== When content inside ''%%[[%%'' and ''%%]]%%'' is not an image URL, it becomes a framed text block. text: "[[Memo: the key is in the library.]]" ===== Inline Markdown ===== ^ Syntax ^ Rendering ^ | ''%%**text**%%'' | Bold | | ''%%*text*%%'' | Italic | | ''%%__text__%%'' | Underline | | ''%%~~text~~%%'' | Strikethrough | | %%``text``%% | Inline code | | ''%%||text||%%'' | Spoiler | | ''> text'' on its own line | Block quote | ===== Highlighted code blocks ===== text: | ```diff - old rule + new rule ``` ```python def roll_dice(faces): return random.randint(1, faces) ``` Supported languages: ''diff'', ''yaml'', ''python'', ''js'', ''json'', ''bash'', and every language handled by highlight.js on web and desktop. On Discord, they fall back to a plain code block. ===== Story Blocks ===== With ''markdown: story'', semantic blocks get a dedicated visual rendering: text: | ```narration The fog thickens between the trees. ``` ```dialogue **The stranger**: You should not have come. ``` ```thought *He is lying.* ``` ```system Objective updated: find the bell. ``` ```journal Night 14. Third sleepless night. ``` Supported story blocks include ''narration'', ''dialogue'', ''thought'', ''system'' and ''journal''. ===== Per-Block Styles ===== text: - "Normal text" - size: 28 font: Georgia text: "A 28 px Georgia title" - size: 14 font: monospace background: "#111827" text-color: "#facc15" text: "A styled badge" ^ Key ^ Value ^ | ''size:'' | Size in pixels, such as ''18'' or ''24''. | | ''font:'' | CSS font family, such as ''Georgia'', ''monospace'' or ''cursive''. | | ''background:'' | CSS background color, such as ''"#111827"''. | | ''text-color:'' | CSS text color, such as ''"#facc15"''. | These keys apply to the whole block on Web and Desktop; Discord and Terminal ignore them. Use inline Markdown to style a single word. ===== Room Background ===== - id: night_room background: "#0d1117" text-color: "#f5f0d8" text: "The room is dark." ===== The global markdown: field ===== Set in the scenario header, it wraps **all** room texts: ^ Value ^ Rendering ^ | ''fix'' | Monospace block (default) | | ''none'' | Plain text | | ''bold'' | Bold | | ''italic'' | Italic | | ''quote'' | Blockquote | | ''story'' | Story blocks enabled | | ''py'' / ''yaml'' / ''js'' / ... | Highlighted code block | ===== Interactive Inline Elements ===== Double braces can also make a word, phrase or picture interactive: text: - "The {{door:?An old door.}} is locked." - "Touch the {{lever:@pull_lever}}." - "Drop the {{key:>key}} onto the {{door:$door}}." See [[en:yaml:tooltips|Interactive tooltips]], [[en:yaml:clickable-elements|Clickable elements]] and [[en:yaml:drag-drop|Drag & drop]]. Tiles and grids use the extended picture syntax: [[en:yaml:tiles-tilemaps|Tiles and tilemaps]]. ===== Reusing the text of another room ===== ''%%[[ROOM:n]]%%'' inserts the narrative content of room number //n// where you write it. Useful for a recurring description or reply, written only once. text: "The corridor goes on.[[ROOM:12]]" The French form is ''%%[[SALLE:n]]%%''. Circular references are detected and stopped: a room cannot include itself, directly or indirectly. The reference works on the web, in the desktop application and in an HTML5 export. Discord, the Terminal and the PDF show the referenced text in their usual linear form. To build a conversation rather than plain text, see [[en:yaml:dialogues|Dialogues and sequences]]. ===== Listing choices in the text ===== ''%%[[choice_vertical]]%%'' lists the current room's choice aliases on separate lines. ''%%[[choice_horizontal]]%%'' separates them with "/". The French forms ''%%[[choix_vertical]]%%'' and ''%%[[choix_horizontal]]%%'' work too. rooms: - id: start text: | What would you like to do? [[choice_vertical]] choices: - command: search to: chest - to: corridor - id: chest text: The chest. - id: corridor text: The corridor. The list shows "search" and "2". Without an alias, a choice uses its position in the declared list, usable directly or with ''go''. Edited aliases and added choices are included during play and in the preview. Choices hidden by conditions are omitted; the other choices keep their numbers. The [[en:editeur:generation|interactive fiction generator]] can add this text, numbered aliases and choice buttons. Directional exit text for mazes and dungeons is replaced during generation instead. ===== Composed text and loops (4.17) ===== A group can carry a condition and style, then contain other text blocks or loops. Styles are inherited; children can override them. text: - if: v_visible_v = 1 size: 23 text: - for_each: item in: bag do: - text: t_item_t Declare ''visible'' in ''vars:'' and ''bag'' in ''lists:''. In text or a HUD, loops cannot change data. The usual media are allowed, without pauses or interactions; repetition depends on author conditions and the client's playback rules. Write media tags in the scenario: ''%%[[t_item.image_t]]%%'' reads an address. An inserted value such as ''t_item.name_t'' stays text even if it contains tags. See [[en:yaml:listes-boucles|Lists and loops]]. In the editor, **Composed content** creates this group. ===== Furniture item and vertical inventory ===== ''%%[[ITEM_IN:coffre]]%%'' inserts the identifier of the first item present in that furniture in the current room, or empty text if it is empty. The French form is ''%%[[OBJET_DANS:coffre]]%%''. ''%%[[INVENTORY_VERTICAL]]%%'' lists one item per line, using item identifiers and grouped quantities. The French form is ''%%[[INVENTAIRE_VERTICAL]]%%''. title: 'Wiki 4.17: inventory' language: en rooms: - id: atelier auto_refresh: true text: | Inventory: [[INVENTORY_VERTICAL]] First item in coffre: [[ITEM_IN:coffre]] objects: - name: cle location: coffre pickup_reaction: Take choices: - command: regarder button: Look to: atelier ''pickup_reaction: Take'' adds the native pickup button for this item in its furniture. ''auto_refresh: true'' refreshes the text after pickup: the key appears in the vertical inventory and the chest is empty. The "Look" choice displays the room again without taking an item. ===== Previous room name ===== ''%%[[SALLE_PRECEDENTE]]%%'' inserts the known previous room ID, not its text or button label. Before the first move, the result is empty. Keep this French tag on English pages too: it has no English alias. title: 'Wiki 4.17: previous' rooms: - id: entree text: 'Previous: [[SALLE_PRECEDENTE]]' choices: - button: Continue to: atelier - id: atelier text: 'Previous: [[SALLE_PRECEDENTE]]' choices: - button: Back to: entree ===== Local alignment and sized splits ===== On Web, Desktop and in HTML exports, ''%%[[align:left]]text[[/align]]%%'' aligns a block. Directions are ''left'', ''center'', ''right'' or ''gauche'', ''centre'', ''droite''. A text variable such as ''t_cote_t'' can provide the direction. Close the block with ''%%[[/align]]%%''. ''%%[[split]]%%'' separates zones. ''%%[[split:40]]%%'' gives 40% to the previous zone; the next receives the remainder. Splits and alignment also work in HUD panels. title: 'Wiki 4.17: alignment' vars_text: cote: right rooms: - id: atelier text: | [[align:left]]Left.[[/align]] [[align:center]]Center.[[/align]] [[align:t_cote_t]]Right.[[/align]] [[split:40]] Second zone. choices: - command: rester button: Stay to: atelier