-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Exploring element mapping to ameliorate extraneous paragraph tags #9610
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
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for tiddlywiki-previews ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Confirmed: Jermolene has already signed the Contributor License Agreement (see contributing.md) |
📊 Build Size Comparison:
|
| Branch | Size |
|---|---|
| Base (master) | 2448.0 KB |
| PR | 2448.9 KB |
Diff: ⬆️ Increase: +1.0 KB
⚠️ Change Note Status
This PR appears to contain code changes but doesn't include a change note.
Please add a change note by creating a .tid file in editions/tw5.com/tiddlers/releasenotes/<version>/
📚 Documentation: Release Notes and Changes
💡 Note: If this is a documentation-only change, you can ignore this message.
|
I know it's an experiment. My concerns: a) It seems to also replace valid P tags. IMO that makes it very hard for to use with user templates / forms that have text and widgets I see it as a workaround, which will make styling even more complex. From my point of view it is a parser problem and not a rendering problem. The redundant P tags should not be created. IMO the problematic code is in In these cases it should not create a P tag at all. IMO the following assumptions: TiddlyWiki5/core/modules/parsers/wikiparser/wikiparser.js Lines 255 to 260 in eb3a809
As I did create my experiments, there where many places in the core UI, where redundant P tags caused problems. Today, IMO there are only a view places left, which could create backwards compatibility problems. Mainly for 3rd party plugins. Most of the redundant P tags have been fixed, without problems. I will merge master into my experiments, so I can be more specific. |
This is an experiment to explore ways of ameliorating TiddlyWiki's habit of inserting extraneous
<p>tags.Motivation
The HTML specification says that
<p>tags cannot contain other<p>tags. TiddlyWiki cheerfully violates this rule (and a bunch of other HTML strictures). In practice, browsers are mostly tolerant of the mis-nesting, but it can cause problems when TiddlyWiki output is consumed by other systems. Also, making the result look correct frequently requires the sort of CSS contortions that are not fun.Mechanism
These changes allow automatically generated
<p>tags to be replaced with any other tag (eg<div>), with the option of adding a class to the element at the same time.It is similar to the existing mechanism for overriding widgets, but just involves overriding the tag generated by the element widget, and so the changes are entirely within that widget
The mappings are specified via specially named variables. The mapping only occurs within the scope of the variable. This example replaces
<p>tags with<div>tags, adding the classmy-class:The end result is that it is possible to completely suppress paragraph generation within a portion of the widget tree.
Questions
This implementation does what it is intended to do, but at this point it is not clear that it represents a practical and broad solution, and so this PR is really just fuel for thought.
<p>tags, without replacing them with another tag?<p>tags automatically setting a mapping to prevent any descendent paragraph tags