Skip Navigation

Search

Remove traditional Markdown styling generated with the Markdown plugin

This is a trick I've stumbled upon several days ago, and I haven't seen it documented anywhere in the examples or advanced tutorial page. If you don't feel like the traditional Markdown style when using the Markdown plugin and simply wanted to use the usual HTML style, you can simply do this:

```javascript markdown = {import:markdown-plugin}

output = [markdown(text).replace("markdown-body", "")] ```

The .replace("markdown-body", "") part is what makes the formatted text loses the Markdown style and goes into the regular HTML style which then you can stylize yourself using CSS to whatever you want. It essentially removes the markdown-body class in the body of the entire markdown text (or that's what I could explain).

1

A cute way to remember text inputs (without the remember-plugin)

This likely won't be relevant to a lot of devs here, because the remember plugin does the job fine in most cases, but:

Here's a normal text input (id is not needed for this example, but is almost always needed so adding it here): html <input id="thingyInput"> And here's one which remembers what you type into it even after page refresh: html <input id="thingyInput" oninput="localStorage.thingy=this.value" value="[localStorage.thingy || '']"> Of course, the remember-plugin can do this for you, but I often find myself reaching for the above pattern for its simplicity.

localStorage is what the remember-plugin uses behind the scenes - whatever you store in it will be persisted even after page refresh. It's a built-in browser/JavaScript feature - not something that's specific to Perchance.

The || '' in [localStorage.thingy || ''] means or ''. In other words, it means or output nothing. If you want a default value for when the user loads the page for the first time, you could write [localStorage.thingy || 'blah'] which means "use whatever is in localStorage.thingy if it exists, otherwise use 'blah'"

9