Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %YAML 1.2
- ---
- Title: Sample Markdown2BBCode Document
- Author: Krusader74
- # This is a YAML comment, not a Markdown header
- # YAML uses the ISO-8601 standard to express dates:
- Date: 2016-01-25T14:25:54-0500
- note: >-
- This is a note intended to demonstrate
- metadata that spans multiple lines, yet
- is treated as a single value.
- foo: bar
- calc: log(exp(1))+2+3+2*2
- ...
- This file illustrates some of the capabilities of the [Markdown2BBCode.pl](http://pastebin.com/dqnHKAe6) Perl script.
- First of all, you can see above that we allow an optional block of [YAML](http://yaml.org/) Metadata at the top. The first line with the YAML version number is optional. YAML goes between a line with three dashes and a line with three dots. You can refer to the metadata later in your Mardown like this:
- The foo variable is [%foo].
- BLOCK ELEMENTS
- ==============
- atx-style headers...
- # Heading 1
- ## Heading 2
- ### Heading 3
- #### Heading 4
- ##### Heading 5
- ###### Heading 6
- # Heading 1 #
- ## Heading 2 ##
- Setext-style headers...
- Heading 1
- =========
- Heading 2
- ---------
- Blockquotes...
- > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
- > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
- > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
- >
- > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
- > id sem consectetuer libero luctus adipiscing.
- Nested blockquotes...
- > This is the first level of quoting.
- >
- > > This is nested blockquote.
- >
- > Back to the first level.
- Blockquotes with formatting inside...
- > ## This is a header.
- >
- > 1. This is the **first** list item.
- > 2. This is the _second_ list item.
- >
- > Here's some example code:
- >
- > return shell_exec("echo $input | $markdown_script");
- Lists...
- Numbered list...
- 3. Bird
- 1. McHale
- 8. Parish
- Bullet list...
- * Red
- * Green
- * Blue
- List items with paragraphs...
- 1. This is a list item with two paragraphs. Lorem ipsum dolor
- sit amet, consectetuer adipiscing elit. Aliquam hendrerit
- mi posuere lectus.
- Vestibulum enim wisi, viverra nec, fringilla in, laoreet
- vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
- sit amet velit.
- 2. Suspendisse id sem consectetuer libero luctus adipiscing.
- A list item with embedded quotes...
- * A list item with a blockquote:
- > This is a blockquote
- > inside a list item.
- This is a normal paragraph:
- This is a code block indented by at least 4 spaces or 1 tab
- ```
- This is a fenced code block
- ```
- Inline BBCode...
- [table]
- [tr]
- [td]Foo[/td]
- [/tr]
- [/table]
- HTML comments are not output to the resulting BBBcode...
- <!-- Regular HTML comment -->
- Tables...
- Colons can be used to align columns.
- | Tables | Are | Cool |
- | ------------- |:-------------:| -----:|
- | col 3 is | right-aligned | $1600 |
- | col 2 is | centered | $12 |
- | zebra stripes | are neat | $1 |
- There must be at least 3 dashes separating each header cell.
- The outer pipes (|) are optional, and you don't need to make the
- raw Markdown line up prettily. You can also use inline Markdown.
- Markdown | Less | Pretty
- --- | --- | ---
- *Still* | `renders` | **nicely**
- 1 | 2 | 3
- Horizontal rules...
- * * *
- ***
- *****
- - - -
- ---------------------------------------
- SPAN ELEMENTS
- =============
- Links
- -----
- This is [an example](http://example.com/ "Title") inline link.
- This is [an example][id] reference-style link.
- [id]: http://example.com/ "Optional Title Here"
- Implicit link name shortcuts...
- [Google][]
- [Google]: http://google.com/
- Images...
- ![Alt text](/path/to/img.jpg)
- ![Alt text](/path/to/img.jpg "Optional title")
- Footnotes...
- Here is some text containing a footnote.[^somesamplefootnote]
- [^somesamplefootnote]: Here is the text of the footnote itself.
- Footnotes can contain block-level elements, which means that you can put multiple paragraphs, lists, blockquotes and so on in a footnote.[^1]
- [^1]: And that's the footnote.
- That's the *second* paragraph.
- - item foo
- - item bar
- - item baz
- > And a quote too.
- Emphasis
- --------
- **This text is bold.**
- _This text is italic._
- *This text is italic too.*
- Non-standard markups... Syntactic sugar for your BBCode...
- __This text is underlined.__
- The following word has a ~~strikethrough~~.
- ^^This text is BIG.^^
- Superscript: E = m c^2^
- Subscript: H~2~O
- Math
- ----
- LaTeX math commands between dollar signs like $e^{i \pi} + 1 = 0$ and $\nabla\times H = J + \frac{\partial D}{\partial t}$ will get converted to Unicode as best as possible.
- If you're not doing math, escape a dollar sign with a slash. For example, this is not math, just US money: \$1.50
- A list of math...
- * square root of two: $\sqrt{2}$
- * Pythagorean theorem: $c = \sqrt{a^2 + b^2}$
- * the circumference of a circle: $2 \pi r$
- * Strength: $\dice{iii}\dice{iv}\dice{ii} = 9$
- * Einstein Field Equations: $G_{\mu \nu} + \Lambda g_{\mu \nu} = \frac{8 \pi G}{c^4} T_{\mu \nu}$
- A table of the [Hypercomplex numbers](https://en.wikipedia.org/wiki/Hypercomplex_number) and their algebraic properties...
- \# = basis elems | Set | [Ordering?](https://en.wikipedia.org/wiki/Ordered_field) | [Commutative?](https://en.wikipedia.org/wiki/Commutative_property) | [Associative?](https://en.wikipedia.org/wiki/Associative_property) | [Alternative?](https://en.wikipedia.org/wiki/Alternative_algebra)
- -------------------------|--------------------------|-----------|--------------|--------------|-------------
- $1 = |\{ 1 \}|$ | Reals $\mathbb{R}$ | Yes | Yes | Yes | Yes
- $2 = |\{ 1, i \} |$ | Complex $\mathbb{C}$ | No | Yes | Yes | Yes
- $4 = |\{ 1, i, j, k \}|$ | Quaternions $\mathbb{H}$ | No | No | Yes | Yes
- $8 = |\{e_i |i=0..7\}|$ | Octonians | No | No | No | Yes
- $16 = |\{e_i |i=0..15\}|$| Sedonions | No | No | No | No
- At-commands
- -----------
- At-commands are a shorthand so I don't need to write BBCode tags twice (beginning/end) or do some other mundane processing...
- Embed a cute cat video from YouTube...
- @[youtube](0Bmhjf0rKe8)
- Embed an image from Imgur. It's easy enough to customize the script to create shortcuts to other photo sharing services. I just happen to use Imgur...
- @[imgur](Hl6gbeN.png)
- Embed a tweet from Twitter...
- @[tweet](690183359117467648)
- Scroll the text to the left...
- @[marquee](I'm a marquee scrolling left at speed 2!)
- Do some basic arithmetic...
- log(exp(1))+2+3+2*2 = @[eval](log(exp(1))+2+3+2*2)
- Same calculation, but now the aritmetic expression is in a metadata variable...
- [%calc] = @[eval]([%calc])
- Note: If you want to use trig constants or functions, then add the line `use Math::Trig;` near the top of the script. Likewise, If you want to do [DateTime](http://search.cpan.org/~drolsky/DateTime-1.21/lib/DateTime.pm) arithmetic, [Statistics](http://search.cpan.org/~shlomif/Statistics-Descriptive-3.0612/lib/Statistics/Descriptive.pm), [Chi Square](http://search.cpan.org/~dcantrell/Statistics-ChiSquare-0.6/lib/Statistics/ChiSquare.pm) tests, generate variates from specific [Random](http://search.cpan.org/~grommel/Math-Random-0.70/Random.pm) distributions, etc., then just `use` the appropriate module!
- Roll some dice to make a new character...
- Ability | Score
- :------------|------------:
- Strength | @[roll](3d6)
- Intelligence | @[roll](3d6)
- Wisdom | @[roll](3d6)
- Dexterity | @[roll](3d6)
- Constitution | @[roll](3d6)
- Charisma | @[roll](3d6)
- Gold | @[eval](10*roll("3d6"))
- Align the text...
- @[left](This text is on the left.)
- @[right](This text is on the right.)
- @[center](This text is centered.)
- The following text is justified...
- @[justify](Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus tincidunt orci lorem, ac consequat magna vulputate at. Duis lacinia velit non massa porttitor, a porta nisi dignissim. Nulla scelerisque, augue ut porttitor commodo, lectus ex tempor nibh, quis venenatis neque ex ac ex. Suspendisse potenti. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum nibh urna, condimentum nec facilisis et, tempor id enim. Sed ac nibh ut sem auctor feugiat. Pellentesque malesuada lectus volutpat vehicula mattis. Praesent vitae imperdiet leo. Vivamus ornare et ante ac malesuada. Vestibulum leo mi, vestibulum quis purus vel, scelerisque finibus magna. Duis finibus sollicitudin augue, et consequat arcu aliquam a.)
- BBCode noparse command protects any text we don't want BBCode altering...
- @[noparse](Create a spoiler in BBCode like this: [spoilers]Stuff that will spoil the *Sixth Sense*.[/spoilers])
- Spoilers...
- @[spoilers](Bruce Willis was dead the whole time!)
- Automatically reverse your text...
- @[reverse](Bruce Willis was dead the whole time!)
- Do rot13 encryption...
- @[rot13](Bruce Willis was dead the whole time!)
- At commands nest...
- @[reverse](@[rot13](Bruce Willis was dead the *whole* time!))
- Protect Markdown text we don't want interpolated...
- @[nomarkdown](@[reverse](@[rot13](Bruce Willis was dead the *whole* time!)))
- Comments don't show up in the output...
- @[comment](An alternative to HTML comments like <!-- this -->)
- Highlight the text...
- @[hi](This text is highlighted.)
- Try to hide the text by making the foreground and background colors the same (only works in the default theme)...
- @[hide](The foreground color is set to efefef.)
- Shrink the text...
- @[small](This text is small!)
- @[smaller](This text is really small!)
- @[smallest](This text is really, really small!)
- <!-- There's also commands for big, bigger, biggest -->
- Syntax shortcuts for the seven colors of the rainbow...
- > @[red](Red) @[yellow](and yellow) @[pink](and pink) @[green](and green,)
- > @[purple](Purple) @[orange](and orange) @[blue](and blue.)
- > I can sing a rainbow,
- > Sing a rainbow,
- > You can sing one too!
- > -- Arthur Hamilton
- > -- "I Can Sing a Rainbow"
- Insert a Markdown file here and then process it...
- @[include](includeme.md)
- Process a file with Markdown2BBC.pl and then insert it here...
- @[process](includeme.md)
- Other standard BBCode tags and custom Markdown should work just fine with these at-command shorthands, but please use the custom Markdown above instead because it's more concise and elegant...
- @[u](This text is underlined) ...versus... __This text is underlined__
- The following word has a @[s](strikethrough) ...versus... The following word has a ~~strikethrough~~
- @[big](This text is BIG) ...versus... ^^This text is BIG^^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement