Discourse Placeholder Forms theme component


This theme component will let you build dynamic documentation, by creating a form that replaces any occurrence of a =PATTERN= in your post with the value from a text or selectable input field.

:link: Repository Link

:link: Preview on Theme Creator


[wrap=placeholder key=NAME description="Your name"][/wrap]
[wrap=placeholder key=COUNTRY default=US defaults=FR,DE,US,CN,AU,CA][/wrap]

Your email: =NAME=-=COUNTRY=@example.com

This will result in:

This is used in mailing list

Your email: =ZNAME=-=ZCOUNTRY=@example.com

As seen above, text inside the wrapper will be used as a long description.

[wrap=placeholder key=NAME description="Your name"]
This is used in mailing list

Available keys

  • key: The key that should be replaced in your post
  • default/defaults: default value(s)
  • description: a placeholder text for the input


# create a new plugin
rails g plugin =PLUGIN_NAME=
cd plugins/=PLUGIN_NAME=

We use it to create runbooks, howtos and reusable templates (it will work in code blocks). Please share your use cases!


Note: I will try to make it work in a theme component in the coming weeks.


I propose that there should be 4 things.

  1. Can sent detail to email.


  1. Can sent detail to inbox of post owner.


  1. Can print detail to PDF file for download.


  1. Can choose an image.



This is now available as a theme component, OP has been updated with info.


I’m interested in this, but I’m really not understanding what exactly it can do. Does it essentially just create variables that are local to a particular user’s form that they have filled out? Thus you can use the fields dynamically elsewhere on the same page prior to form submission?

Also, the current example displays the following that didn’t help me understand:


Preview should now work even if you are not logged in.

Try it, and maybe you will understand now, I made a more compelling sample.


Same here. @joffreyjaffeux, could you share some of your use cases in more detail? It sounds like it might be very useful, if only I understood it.

Thanks for this very useful feature.

To explain this, the key word for me is “runbook” which is a reference guide to the commands and procedures that I might need to use on my system.

This theme component allows me to create a generic runbook where each variable can be manually entered to customise commands for my system and any other system.

The post content can represent the content of a script or batch file. The manual inputs are the equivalent of runtime arguments but instead of entering them on the commandline, I enter them in a form.

Using the preview in the OP, the original post displays:

# move folder
cp -R =old_server_name= ./backup
mv =old_server_name= =new_server_name=

I’ve entered two variables which are my server names. The updated post now displays the commands for my system:

# move folder
cp -R OldServer ./backup
mv OldServer NewServer

AFAIK, the scope of the variables I enter is limited to that post.

Note that all variables have to be be manually entered as environment variables cannot be automatically filled in. Automatic entry of environment variables would be a great addition to this.


Yes runbooks is the main use case I created this component for.

# create a new plugin
rails g plugin =PLUGIN_NAME=
cd plugins/=PLUGIN_NAME=

EDIT. Sorry. some other theme component was causing a prolblem.

EDIT2: Or maybe I needed to reload the page? Now I can’t make it break again.

I just installed this theme component on a recent 2.4.0.beta6 and the descriptions are not displaying. Using the same text in OP I get:

And I can’t type in the boxes.

Am I doing something wrong?

How hard would it be to have this plugin, say, pull data from custom user fields?


Thanks @joffreyjaffeux - this is really useful and we have just started using it in thepavilion.io for some templating and living documentation.

I’m interested in the ‘runbooks’ you mention - are you using GitHub - braintree/runbook: A framework for gradual system automation or are you using the term ‘runbook’ in its wider meaning?


Yes we call runbooks, any step by step process you would have to follow to achieve some operation which is not scripted (yet).


Hi @joffreyjaffeux this plugin is now deprecated, what is the plan here? Is it just EOL or is it coming in Discourse core, or neither? I find it really useful and was hoping more features might come in over time, as per @pfaffman’s suggestions.

Nothing for the plugin, you should use the theme component.


Aha, my mistake, I just googled for the repo and didn’t really look properly at the repo name!
I needed GitHub - discourse/discourse-placeholder-theme-component: discourse-placeholder-theme-component as per the OP

1 Like

That’s a great idea.

Is it possible to do something like that:

 [wrap=placeholder key=Game1 description="Your name"][/wrap]
 [wrap=placeholder key=Game2 description="Your name2"][/wrap]
 [wrap=placeholder key=Game3 description="Your name3"][/wrap]

 [wrap=placeholder key=Bookie default=US defaults=Game1(but from placeholder Game1),Game2(etc),Game3][/wrap]
1 Like

No, it’s intended to be simple to a full fledge form. Might improve it one day though. Would rather have real use cases than “possible solutions” though.

1 Like

Okay, but whatever if these fields can be edited by any user. They can’t be permanent in the post once edited by autor?

default is here to solve this no ?

Well, it would be better if the user creating the topic had these fields and then it wouldn’t be possible to change it anymore in post