Remove simple markdown from tooltip shortcode

You can just use HTML and this opened too many issues to be worth it.
This commit is contained in:
Tetrakern 2024-10-04 18:06:28 +02:00
parent bc22be2dfd
commit 492b7a915b
2 changed files with 4 additions and 18 deletions

View File

@ -1429,16 +1429,16 @@ Renders the theme sidebar (not displayed anywhere by default). Requires the "Dis
### Tooltip (Modal)
Includes a tooltip modal for the wrapped content, indicated by a dotted underline. Just omit the shortcode block and write it directly into the text. You can format words or phrases inside the tooltip content as \***bold**\* or \_*italic*\_ and escape the special characters with a `$` prefix (WP sanitized backslashes). This shortcode also works if your role lacks the shortcode capability.
Includes a tooltip modal for the wrapped content, indicated by a dotted underline. Just omit the shortcode block and write it directly into the text. This shortcode also works if your role lacks the shortcode capability.
**Note:** You can technically use HTML in the shortcode content attribute, as far as the post sanitizer and user role allows. However, be cautious of nested quotation marks and square brackets, as they can break the shortcode — use [HTML entities](https://developer.mozilla.org/en-US/docs/Glossary/Character_reference) instead.
**Note:** You can use HTML in the shortcode content attribute, as far as the post sanitizer and user role allows. However, be cautious of nested quotation marks and square brackets, as they can break the shortcode — use [HTML entities](https://developer.mozilla.org/en-US/docs/Glossary/Character_reference) instead.
```
[fcnt content="This is a note."]note[/fcnt]
[fcnt content='This is a note.']note[/fcnt]
```
```
[fcnt header="Are you dense?" content="This _typically_ refers to forms that are either literal *skeletons* or the underlying bearing $*structure* of objects."]skeletal shapes[/fcnt]
[fcnt header='Are you dense?' content='This <em>typically</em> refers to forms that are either literal <strong>skeletons</strong> or the underlying bearing *structure* of objects.']skeletal shapes[/fcnt]
```
![Showcase](repo/assets/fcnt_example.jpg?raw=true)

View File

@ -2348,20 +2348,6 @@ function fictioneer_shortcode_tooltip( $atts, $content = null ) {
return $content;
}
// Escaped markdown (WP strips slashes, so we use $ as escape character)
$modal_content = str_replace( '$*', '$ESCAPED_ASTERISK$', $modal_content );
$modal_content = str_replace( '$_', '$ESCAPED_UNDERSCORE$', $modal_content );
// Convert _text_ to <em>text</em>
$modal_content = preg_replace( '/_(.*?)_/', '<em>$1</em>', $modal_content );
// Convert *text* to <strong>text</strong>
$modal_content = preg_replace( '/\*(.*?)\*/', '<strong>$1</strong>', $modal_content );
// Cleanup
$modal_content = str_replace( '$ESCAPED_ASTERISK$', '*', $modal_content );
$modal_content = str_replace( '$ESCAPED_UNDERSCORE$', '_', $modal_content );
// Build attributes
if ( ! empty( $modal_header ) ) {
$data .= 'data-dialog-header="' . esc_attr( $modal_header ) . '" ';