# Markdown Extensions for BBCode

**URL:** <https://meta.discourse.org/t/markdown-extensions-for-bbcode/150224>\
**Category:** Development\
**Created:** [May 3, 2020, 3:56am UTC](https://meta.discourse.org/t/markdown-extensions-for-bbcode/150224 "2020-05-03T03:56:06Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Ghan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ghan/32/177964_2.png) [@Ghan](https://meta.discourse.org/u/Ghan)\
**Post date:** [May 3, 2020, 3:56am UTC](https://meta.discourse.org/t/markdown-extensions-for-bbcode/150224/1 "2020-05-03T03:56:06Z")

</div>

I am trying to learn how to write markdown rules to implement new bbcode functionality using this guide, however I’m having a really hard time following what is going on as there is so much that is unexplained:

> [@Developer's guide to Markdown extensions](https://meta.discourse.org/t/developers-guide-to-markdown-extensions/66023):
>
> Discourse uses a Markdown engine called [Markdown-it](https://github.com/markdown-it/markdown-it). Here are some dev notes that will help you either fix bugs in core or create your new plugins. The Basics Discourse only contains a few helpers on top of the engine, so the vast majority of learning that needs to be done, is understanding Markdown It. The [docs directory](https://github.com/markdown-it/markdown-it/tree/master/docs) contains the current documentation. I strongly recommend reading: The [architecture document](https://github.com/markdown-it/markdown-it/blob/master/docs/architecture.md) to understand at a top level how the engine works. [Development](https://github.com/markdown-it/markdown-it/blob/master/docs/development.md) for basic d…

I also checked out the markdown-it documentation, but it is very sparse and seems to mostly be a very high-level overview of the functionality of the system. Some specific question I have:

- The guide has this line: `// standard markdown it inline extension goes here.`  
What is the standard inline extension? Is this where you define the rules that are pushed to the ruler? Why does it return false?

- What are the token types? I see examples like `'link_open'` and `'html_inline'` - where do these come from? Is there a static list somewhere of what is available? Can I add new ones? How does the parser know what to do with these?

> [@Developer's guide to Markdown extensions](https://meta.discourse.org/t/developers-guide-to-markdown-extensions/66023/1):
>
> In this case we are replacing an entire `[code]code block[code]` with a single `code_inline` token.

How does this work? How does the parser know what `'code_inline'` does? What does the state.push() function do and how is it intended to be used?

I feel like I’m close to “getting it” but I think I’m missing some concepts. I’ve written the most basic of rules and it appears to be working - I just need a better understanding to move forward. Any help would be appreciated!

---

_[View the full topic](https://meta.discourse.org/t/markdown-extensions-for-bbcode/150224)._
