SalesforceFoundation / ApexDoc

The latest java source for ApexDoc, a tool to document your Salesforce Apex classes.
BSD 3-Clause "New" or "Revised" License
229 stars 128 forks source link

Support For Whitelisted HTML Tag Passthrough #43

Open justco opened 9 years ago

justco commented 9 years ago

I'm not sure if this is intended or not, but HTML tags will pass through for only the brief description of a method, but not for the full method description. To be more specific...

In the method htmlForClassModel() in FileManager.java, when generating the HTML for <div class="methodTOCDescription">, escapeHTML() is NOT called, but when generating the HTML for <div class="methodDescription">, escapeHTML() IS called.

I understand this is a bit tricky because you want to be able to support < and > being shown in the documentation and not embedded as html tags, but it's a bit confusing that it will pass tags through for one part and escape them in another.

As for the passthrough, perhaps escapeHTML() in FileManager.java could be overloaded to accept an array of whitelisted ignore-tags which you know won't mess up the structure of the generated doc. Then, depending on what part of the doc you are generating when you call escapeHTML() you can toss in different acceptable tags like <code>, <ul>, <ol>, <li>, <pre>, <p> and maybe <b>, <i>.