Forum Enhancer
#1

Forum Enhancer
Introduction

This Greasemonkey/Tampermoney script allows you to write forum posts in markdown, with full pawn syntax highlighting automatically. It also supports ctrl+enter to submit, and tabbing within text for indentation.

Download

https://openuserjs.org/scripts/y-les...Forum_Enhancer

Note that this is a “user script”, a script that enhances a website from the browser directly. Thus you will need one of the addons used to run these scripts:

Firefox (tested): https://addons.mozilla.org/en-GB/fir.../tampermonkey/

Chrome (not tested): https://chrome.******.com/webstore/d...jmpbldmpobfkfo

For more information and other browsers see this link:

https://openuserjs.org/about/Userscript-Beginners-HOWTO

Background

Southclaws got sick of writing BB code (and who can blame him), so wrote forumfmt to convert markdown in to BB code. This was originally written as an offline tool to convert documentation from github in to something that could be posted on the forums. However, I decided I wanted it more integrated so wrote this script to intercept post submissions, translate the text with the tool, and then submit that adjusted code instead.

What’s wrong with BB code? Well simply it isn’t widely used. If you write documentation on github, you’ll use markdown. If you write things on discord, you use markdown. It makes sense to be able to use the same code everywhere. Also, the [pawn] tags are broken on the forums, and didn’t support common keywords like foreach anyway.

Usage

Usage it very simple. When you make a post on the forums, use markdown instead of BB code. When you click post, or hit ctrl+enter (because tab no longer moves to the control) the text is converted and submitted.

You can also use tab as in code editors - including block indentation and unindentation of multiple selected lines.

Editing

Unfortunately, currently if you try edit a post you will only see the generated BB code, not the original markdown. Thus, I suggest you keep a backup somewhere and edit and re-paste that version. This isn’t hard if you are keeping documentation synced between the forums and github, since github will have the original still. Also, for some reason sometimes the “edit” screen doesn’t get the enhancement, I don’t know why, but just press F5 and it will be fine.

Markdown

For more information on markdown, there are hundreds of sites with more documentation. But for a brief example, this:

# Main heading

## Second heading

```
code
```

```pawn
// syntax-highlighted PAWN code (with extensions)
foreach (new i : Player)
{
if (i > 5)
printf("%d", i);
}
```

* **Bold list item 1**
* *Italic list item 2*
* List item 3 with `inline code`


Gives:

Main heading
Second heading

code


Code:
// syntax-highlighted PAWN code (with extensions)
foreach (new i : Player)
{
    if (i > 5)
        printf("%d", i);
}
  • Bold list item 1
  • Italic list item 2
  • List item 3 with inline code
Reply
#2

Splendid! makes you hungry to write some tutorials, I got sick from manual setting colors to pawn keywords in my tutorials. +REP.
Reply
#3

Another great done by Y_less <3
REP+
Reply
#4

The whole point of Markdowns looks interesting and useful. Bravo Y-Less once again .
Reply
#5

Niiice. There is some problems. We can’t preview a message, it post it automatically. Plus, it doesn’t seems to detect pawn syntax when you write natives.

Example:

Code:
native Attach3DTextLabelToActor(actorid, text[], color, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:drawdistance, virtualworld = DEFAULT_ACTOR_VALUE, testlos = 0, bool:store_string = true);
native SetActorInvulnerable(actorid, invulnerable = true); // Force actor re-stream
native SetActorVirtualWorld(actorid, vworld); // Force actor re-stream
native SetActorFacingAngle(actorid, Float:ang); // Force actor re-stream
native CountStaticActors();
Edit: editing an converts markdown code to bbcode converts it again to something glitched.
Code:
 native Attach[COLOR=“Purple”]3[/COLOR]DTextLabelToActor(actorid, text[], color, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:drawdistance, virtualworld = DEFAULT_ACTOR_VALUE, testlos = [COLOR=“Purple”]0[/COLOR], bool:store_string = true); native SetActorInvulnerable(actorid, invulnerable = true); [COLOR=“Green”]// Force actor re-stream[/COLOR] native SetActorVirtualWorld(actorid, vworld); [COLOR=“Green”]// Force actor re-stream[/COLOR] native SetActorFacingAngle(actorid, Float:ang); [COLOR=“Green”]// Force actor re-stream[/COLOR] native CountStaticActors();
Reply
#6

Splendid work, once again!
Reply
#7

Woah cool release, I've been already using it for a month now. DOPE AS ALWAYS.
Reply
#8

Quote:
Originally Posted by Dayrion
View Post
Niiice. There is some problems. We can’t preview a message, it post it automatically.
Yeah, I discovered that very late on sorry.

Quote:
Originally Posted by Dayrion
View Post
Plus, it doesn’t seems to detect pawn syntax when you write natives.

Example:
That's an issue with the style not the system. It isn't addressed at all here, but if you check the original forumfmt code you'll see you can have custom styles.

Quote:
Originally Posted by Dayrion
View Post
Edit: editing an converts markdown code to bbcode converts it again to something glitched.
Code:
 native Attach[COLOR=“Purple”]3[/COLOR]DTextLabelToActor(actorid, text[], color, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:drawdistance, virtualworld = DEFAULT_ACTOR_VALUE, testlos = [COLOR=“Purple”]0[/COLOR], bool:store_string = true); native SetActorInvulnerable(actorid, invulnerable = true); [COLOR=“Green”]// Force actor re-stream[/COLOR] native SetActorVirtualWorld(actorid, vworld); [COLOR=“Green”]// Force actor re-stream[/COLOR] native SetActorFacingAngle(actorid, Float:ang); [COLOR=“Green”]// Force actor re-stream[/COLOR] native CountStaticActors();
I addressed that in the first post.

Quote:
Originally Posted by Uproar
View Post
Splendid work, once again!
Quote:
Originally Posted by Zeth
View Post
Woah cool release, I've been already using it for a month now. DOPE AS ALWAYS.
Thanks
Reply
#9

Great work (again), but I have a question - can you (at least try to) add a "greater-than" sign to this script? I mean - on some forums, like Reddit or... Reddit, or other 4chans, you can use the ">" symbol to quote something.
I.E.:
Quote:

> This is just a random quote

Is it possible to do that?

Oh, and btw, I've got a nice message in a window "Could not retrieve BB code:" and there wasn't any bbcode below. Not sure what happened and if this is caused by your script or by forum js but it happened to me when I tried to use the ">" symbol to show an example quote. Even F5 key didn't help so I had to temporarily disable my greasemonkey just to edit this message.
Reply
#10

Quotes are useful, I'll look in to that - it just depends on the go markdown library. As for BB code, that is what is being generated, so if it can't be retrieved it means the server failed for some reason.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)