Skip to content

Easy Filter for Moodle

I’ve been playing around with Moodle plugins for the past few days and have kicked out a couple that are working, at least well enough for me to use.

One of them solved a pretty trivial task for me, but one that should save some time down the road. And that’s formatting.

Teaching Computer Science I type a lot of code into question banks. Sure, the WYSIWYG editor in Moodle makes it pretty easy to change fonts. But I wanted something more like BBCode that’s popular on web forums or shortcodes in WordPress. Something that lets me keep my hands on the keyboard and not having to mouse around to change fonts.

What I came up with is a filter plugin that I’m calling Easy Filter. From the admin settings pages you can define a tag to wrap around question text and then what the filter puts in place before and after that text as the page is displayed. For example, I have a ‘java’ tag setup that I’m using to wrap around any Java code in questions or pages. When I wrap Java code like this – [pre]System.out.println(“Hello”);[/pre] it  wraps it in a <pre> tag to format in a monospaced font.

And, here’s a screenshot…


The screenshot has 3 different tags defined, along with their before and after HTML. The bottom form is for adding more tags. To remove a tag you just blank it out on the list and hit the Update button.


The plugin is hosted at GitHub. Once you download the zip, you’ll need to upload everything to the /filter/easyfilter/ folder under your Moodle root.

Published inMoodle

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *