diff --git a/src/applications/macro/markup/PhabricatorIconRemarkupRule.php b/src/applications/macro/markup/PhabricatorIconRemarkupRule.php index ce1212b0fc..acd87d4136 100644 --- a/src/applications/macro/markup/PhabricatorIconRemarkupRule.php +++ b/src/applications/macro/markup/PhabricatorIconRemarkupRule.php @@ -1,79 +1,88 @@ getEngine(); $text_mode = $engine->isTextMode(); $mail_mode = $engine->isHTMLMailMode(); if (!$this->isFlatText($matches[0]) || $text_mode || $mail_mode) { return $matches[0]; } $extra = idx($matches, 1); // We allow various forms, like these: // // {icon} // {icon camera} // {icon,camera} // {icon camera color=red} // {icon, camera, color=red} $extra = ltrim($extra, ", \n"); $extra = preg_split('/[\s,]+/', $extra, 2); // Choose some arbitrary default icon so that previews render in a mostly // reasonable way as you're typing the syntax. $icon = idx($extra, 0, 'paw'); $defaults = array( 'color' => null, + 'spin' => false, ); $options = idx($extra, 1, ''); $parser = new PhutilSimpleOptions(); $options = $parser->parse($options) + $defaults; // NOTE: We're validating icon and color names to prevent users from // adding arbitrary CSS classes to the document. Although this probably // isn't dangerous, it's safer to validate. static $icon_names; if (!$icon_names) { $icon_names = array_fuse(PHUIIconView::getFontIcons()); } static $color_names; if (!$color_names) { $color_names = array_fuse(PHUIIconView::getFontIconColors()); } if (empty($icon_names['fa-'.$icon])) { $icon = 'paw'; } $color = $options['color']; if (empty($color_names[$color])) { $color = null; } + $classes = array(); + $classes[] = $color; + + $spin = $options['spin']; + if ($spin) { + $classes[] = 'ph-spin'; + } + $icon_view = id(new PHUIIconView()) - ->setIconFont('fa-'.$icon, $color); + ->setIconFont('fa-'.$icon, implode(' ', $classes)); return $this->getEngine()->storeText($icon_view); } } diff --git a/src/docs/user/userguide/remarkup.diviner b/src/docs/user/userguide/remarkup.diviner index ef38552489..ca20751c47 100644 --- a/src/docs/user/userguide/remarkup.diviner +++ b/src/docs/user/userguide/remarkup.diviner @@ -1,626 +1,632 @@ @title Remarkup Reference @group userguide Explains how to make bold text; this makes your words louder so you can win arguments. = Overview = Phabricator uses a lightweight markup language called "Remarkup", similar to other lightweight markup languages like Markdown and Wiki markup. This document describes how to format text using Remarkup. = Quick Reference = All the syntax is explained in more detail below, but this is a quick guide to formatting text in Remarkup. These are inline styles, and can be applied to most text: **bold** //italic// `monospaced` ##monospaced## ~~deleted~~ __underlined__ D123 T123 rX123 # Link to Objects {D123} {T123} # Link to Objects (Full Name) {F123} # Embed Images {M123} # Embed Pholio Mock @username # Mention a User #project # Mention a Project [[wiki page]] # Link to Phriction [[wiki page | name]] # Named link to Phriction http://xyz/ # Link to web [[http://xyz/ | name]] # Named link to web [name](http://xyz/) # Alternate Link These are block styles, and must be separated from surrounding text by empty lines: = Large Header = == Smaller Header == ## This is a Header As Well Also a Large Header =================== Also a Smaller Header --------------------- > Quoted Text Use `- ` or `* ` for bulleted lists, and `# ` for numbered lists. Use ``` or indent two spaces for code. Use %%% for a literal block. Use | ... | ... for tables. = Basic Styling = Format **basic text styles** like this: **bold text** //italic text// `monospaced text` ##monospaced text## ~~deleted text~~ __underlined text__ Those produce **bold text**, //italic text//, `monospaced text`, ##monospaced text##, ~~deleted text~~, and __underlined text__, respectively. = Layout = Make **headers** like this: = Large Header = == Smaller Header == ===== Very Small Header ===== Alternate Large Header ====================== Alternate Smaller Header ------------------------ You can optionally omit the trailing `=` signs -- that is, these are the same: == Smaller Header == == Smaller Header This produces headers like the ones in this document. Make sure you have an empty line before and after the header. Lists ===== Make **lists** by beginning each item with a `-` or a `*`: lang=text - milk - eggs - bread * duck * duck * goose This produces a list like this: - milk - eggs - bread (Note that you need to put a space after the `-` or `*`.) You can make numbered lists with a `#` instead of `-` or `*`: # Articuno # Zapdos # Moltres Numbered lists can also be started with `1.` or `1)`. If you use a number other than `1`, the list will start at that number instead. For example, this: ``` 200) OK 201) Created 202) Accepted ``` ...produces this: 200) OK 201) Created 202) Accepted You can also nest lists: ```- Body - Head - Arm - Elbow - Hand # Thumb # Index # Middle # Ring # Pinkie - Leg - Knee - Foot``` ...which produces: - Body - Head - Arm - Elbow - Hand # Thumb # Index # Middle # Ring # Pinkie - Leg - Knee - Foot If you prefer, you can indent lists using multiple characters to show indent depth, like this: ```- Tree -- Branch --- Twig``` As expected, this produces: - Tree -- Branch --- Twig You can add checkboxes to items by prefacing them with `[ ]` or `[X]`, like this: ``` - [X] Preheat oven to 450 degrees. - [ ] Zest 35 lemons. ``` When rendered, this produces: - [X] Preheat oven to 450 degrees. - [ ] Zest 35 lemons. Make **code blocks** by indenting two spaces: f(x, y); You can also use three backticks to enclose the code block: ```f(x, y); g(f);``` You can specify a language for syntax highlighting with `lang=xxx`: lang=text lang=html ... This will highlight the block using a highlighter for that language, if one is available (in most cases, this means you need to configure Pygments): lang=html ... You can also use a `COUNTEREXAMPLE` header to show that a block of code is bad and shouldn't be copied: lang=text COUNTEREXAMPLE function f() { global $$variable_variable; } This produces a block like this: COUNTEREXAMPLE function f() { global $$variable_variable; } You can use `lines=N` to limit the vertical size of a chunk of code, and `name=some_name.ext` to give it a name. For example, this: lang=text lang=html, name=example.html, lines=12, counterexample ... ...produces this: lang=html, name=example.html, lines=12, counterexample
Apple
Apricot
Avocado
Banana
Bilberry
Blackberry
Blackcurrant
Blueberry
Currant
Cherry
Cherimoya
Clementine
Date
Damson
Durian
Eggplant
Elderberry
Feijoa
Gooseberry
Grape
Grapefruit
Guava
Huckleberry
Jackfruit
Jambul
Kiwi fruit
Kumquat
Legume
Lemon
Lime
Lychee
Mandarine
Mango
Mangostine
Melon
You can use the `NOTE:`, `WARNING:` or `IMPORTANT:` elements to call attention to an important idea. For example, write this: ``` NOTE: Best practices in proton pack operation include not crossing the streams. ``` ...to produce this: NOTE: Best practices in proton pack operation include not crossing the streams. Using `WARNING:` or `IMPORTANT:` at the beginning of the line changes the color of the callout: WARNING: Crossing the streams can result in total protonic reversal! IMPORTANT: Don't cross the streams! In addition, you can use `(NOTE)`, `(WARNING)`, or `(IMPORTANT)` to get the same effect but without `(NOTE)`, `(WARNING)`, or `(IMPORTANT)` appearing in the rendered result. For example, this callout uses `(NOTE)`: (NOTE) Dr. Egon Spengler is the best resource for additional proton pack questions. = Linking URIs = URIs are automatically linked: http://phabricator.org/ If you have a URI with problematic characters in it, like "`http://comma.org/,`", you can surround it with angle brackets:Fruit | Color | Price | Peel? |
---|---|---|---|
Apple | red | `$0.93` | no |
Banana | yellow | `$0.19` | **YES** |
Fruit | Color | Price | Peel? |
---|---|---|---|
Apple | red | `$0.93` | no |
Banana | yellow | `$0.19` | **YES** |