Jump to content

Quick question: Show Markdown code in field notes


wheelmaker24
 Share

Recommended Posts

Hi,

just a quick question: I want to add the following text to the note field of a template field:

To add a link insert [Title](http://www.your.url) to your text.

Unfortunately this is parsed automatically and it shows something like this:

To add a link insert Title to your text.

I tried escaping the Markdown code with backslashes, but this didn't lead to the expected result. Any ideas?

Thanks! :-)
Nik 

Link to comment
Share on other sites

Ryan is not using a markdown parser for field descriptions/notes as they're only supporting a small subset of markdown (I think links/bold/italic and that's it) and it's faster this way, but that's probably the reason, why escaping doesn't work. 

  • Like 1
Link to comment
Share on other sites

  • 6 years later...

An old topic but I just hit this problem too, where I want to give an example of Markdown format in the field description without that actually being converted into HTML.

I solved it by setting the Inputfield textFormat property in a hook:

// Avoid Markdown in description/notes being converted into HTML
// Adjust as needed for your Inputfield type and field name
$wire->addHookAfter('InputfieldTextarea::renderReadyHook', function(HookEvent $event) {
	/** @var InputfieldTextarea $inputfield */
	$inputfield = $event->object;
	if($inputfield->name === 'my_field_name') {
		$inputfield->textFormat = Inputfield::textFormatNone;
	}
});

 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...