Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds
SanitiseHtml()
extension method for sanitising markup inline with https://iiif.io/api/presentation/3.0/#45-html-markup-in-property-valuesThis introduces a dependency on https://github.com/mganss/HtmlSanitizer but this appears to be the goto library for dotnet and saves a lot of work.
The above lib doesn't support specifying valid tags per attribute but provides
RemovingAttribute
callback that allows same functionality by specifying no attributes are allowed and cancel those that should be safe in the callback.It's not specified in the spec but the method will wrap content in a provided tag (defaults to
span
) if the string doesn't start with<
and end with>
. This makes an assumption that this method is only ever called when consumer wants the output to be markup.