-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raw handling: skip inline shortcodes #6329
Conversation
Also wondering if this should only happen if the transformer is added by the shortcode block. If there is any other block transforming the shortcode, we should probably just let it happens. I think the problem here is the catch-all. Cc @mcsf. |
Maybe we come back here to something like |
Good question, though I'm not quite convinced. I guess this specific handling of inline shortcodes is mainly in place for backwards compatibility, but also as a way to cope with current limitations of the block paradigm:
And, conceptually, when transitioning to Gutenberg, I'd expect the latter scenario to convert to Does this make sense, or was I just rambling? 🙂 |
@mcsf That makes sense. So what do you think of the handling in this PR? |
Should the shortcode converter have knowledge of the Markdown converter? Can the shortcode conversion take place before Markdown-ification takes effect? |
@aduth @mcsf We discussed this a few times, and I'm not sure what the right solution here is. Shortcakes and Markdown can conflict: |
Maybe we should only run one of these (markdown or shortcode) depending on the content, but I'm not sure what to look for. Shortcodes can also be found in plain text when pasting from the text editor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure we can fine-tune this in the future if we run into special cases. For now, this is a welcome fix for me.
lastIndex = match.index + match.content.length; | ||
|
||
// If the shortcode content does not contain HTML and the shortcode is | ||
// not on new line (or in paragraph from Markdown converter), consider | ||
// the shortcode as inline text. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add at the end of the sentence: , and thus skip conversion for this segment. Does it make sense?
edit: I've amended
8a8b068
to
10df601
Compare
Thanks for reviewing @mcsf! |
@danielbachhuber Yes. There's no module yet for the shortcodes, it's still a window global. |
Description
This PR implements #3806 (comment).
Fixes #3806.
Only if the shortcode is preceded by a newline (or a plain paragraph tag from the Markdown converter), we should create a shortcode block. Otherwise we should like the shortcode alone as text.
I think this may be a bit too simplistic, but generally goes in the right direction. Maybe we should also check if the shortcode contains any HTML. If it does, maybe it should be "preserved" in a block.
How has this been tested?
See #3806 (comment).
Screenshots
Types of changes
Checklist: