-
Notifications
You must be signed in to change notification settings - Fork 875
Footnotes separator logic needs revision for 3.0 #723
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
Comments
The alternate separator behavior seems to have been introduced as a solution for #180 in 41cc055. I had completely forgot about this when reducing the output formats (in #633). For the record, after 41cc055 any formats prior to HTML5 continued to use the old format (a colon as a separator in the footnote ids), while HTML5 switched to using a hyphen as the separator. Of course, with the 3.0 release, we reduced the output formats to The problem is that that is not backward compatible for users who either intentionally chose pre-HTML5 formats or who previously were not picky and used the non-version specific format (which used to default to a pre-HTML5 format). In other words, whichever way we go, we will break things for half of our users. So the question is: which half do we break things for? |
Thinking about this further I am reminded that the footnotes extension had always been intended as a clone of PHP Markdown Extra's footnote behavior. In fact, the one notable difference was that we used a hyphen rather than a colon as a separator in the footnote ids for HTML5 output. As PHP Markdown does not have an HTML5 specific output format, that has never been an option for them. Additionally, there is nothing in the HTML5 spec which prevents a colon from being part of an id. Therefore, I am inclined to leave the behavior as-is, that is, only use a colon as the separator. However, it is reasonable to expect that some users will want the hyphen rather than the colon in their output. It is even possible that a few users have specifically chosen one of the HTML5 specific output formats for this reason alone. Therefore, it makes sense to add a new configuration option which allows the user to define their own separator (the default being a colon). |
👍 |
I was looking to take care of this and I saw this in the footnote code: if self.footnotes.md.output_format not in ['html5', 'xhtml5']:
a.set('rel', 'footnote') # invalid in HTML5 So, should we just rip this out? It used to not be set if |
It seems that |
This is directly related to michelf/php-markdown#58. As our implementation is a clone of PHP Markdown Extra, let's do whatever that implementation does. Personally I had forgotten that we had different behavior for HTML5 versus earlier formats. |
Looks like they are just using classes I'll take this on and just update footnotes to generally stop looking to the output format for specific changes. A configuration will added called |
Footnotes was the first extension ever and existed before I got involved in the project. There are some unusual (or at least unpythonic) naming conventions in the old code (such as mixedCase and/or CamelCase rather than lowercase_with_underscores for method names etc). We really should have changed all that in the 3.0 release, but in the end, backward compatibility won out over style. What i'm not sure about is what style we should use for newer additions. Should we just copy the existing style for consistency or follow a modern style guide? The footnotes extension is the worst offender here. Part of me wants to completely rework it but that might be a little to user hostile. I suppose, in the end I'll accept whatever color you paint this shed. |
I kind of wish we could normalize input configurations key names and just use lower case internally. As far as footnotes go, I don't really have a preference. I'd be happy to use lowercase for new options regardless of what previous options were, but I figured I'd go with the status quo in case people wanted to complain about it. |
Unfortunately normalization would never work as 3rd party extensions can't be controlled. |
I was going to suggest that we could normalize the options in the config handling methods of the Unless we override the config lookup as well. Provide our own |
That's an interesting idea. If we were overriding the getter, we could also generate deprecation warnings... Something to play around with as a separate issue. |
Since
output_format
is now limited tohtml
orxhtml
, thisif
branch in footnotes extension will never be True. Therefore a different output is generated compared to the previous versions if you hadhtml5
orxhtml5
, and that is causing test errors (see getpelican/pelican#2414).It is not clear to me which of the separator options is preferable now, so I'm hesitant to adjust the test outputs in pelican prematurely.
The text was updated successfully, but these errors were encountered: