-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Change writerSetextHeaders in default to False. #6693
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
Conversation
|
Hi, the tests for Where I would expect it to fail like: Somehow the If I understand correctly this is reading the
Regards |
|
The failed test: is also unexpected. Why is there no I think all the relevant tests should be duplicated to test both headings styles whenever markdown is involved. |
This is because in the ipynb output, the markdown is divided into lines, and the newline is omitted on the last line. |
Could be a bug in the test setup? That's really puzzling. I can't look into it right now though.
Something in
We've been transitioning from "headers" to "headings," esp. in the public-facing parts (documentation, command-line options), but we've left "headers" in some places for backwards compatibility. So I'm thinking "headings" is better for the new option, even though it's a bit odd to have both. Note that after this change, the only command-line options with "headers" (in this sense) will be deprecated ones. We could introduce One question is whether
Bigger question: Perhaps instead of I like that better, as it makes it clearer what syntax this affects. If we did this, it would probably be good to change the Opt structure accordingly, and to make sure |
|
I'll see to:
|
|
I implemented the |
|
About the failing This pull request's version generates the For example check the About the failing Considering The final piece would be A final argument is that the resulting file can be viewed with jupyter 4.6.3. |
|
I'm confused about why a change of default from setext to atx headers in the markdown writer has any ramifications at all for metadata in ipynb. Can you explain this? |
|
I'm having multiple issues with this:
Issue 2: With the reader: this PR writes metadata present in the source; absent in the test. So maybe this was an issue "slipping through the cracks".
EDIT: I think I accidentally modified the gold standards while verifying the that results where valid Finally, to address your question: So So it calls: I'll look around those functions to see if I can spot anything. |
|
OK, so the metadata "changes" were introduced when I used TestsSome tests were changed to use the new default.
markdown+lhsNew behavior (RFC)The markdown output for markdown+lhs is: That is: There are no headings. This is the original behavior. I added a Original BehaviorUsing the new flag: works as before. Perhaps the combination of Let me know what you think. |
That's a good thought. Maybe it would make more sense to issue a warning in the markdown writer when we "downshift" an ATX heading to a paragraph. Something like: "Rendering ATX heading as a paragraph, because # in the left-hand column is interpreted as CPP in lhs output. Consider using --markdown-headings=setext" If they don't have any headings, they won't get the warning and things will be fine. IF they do, they can react as they like. |
|
This would require adding a new constructor to LogMessage in Logging. |
DetailsI added the constructor That means that Resulting WarningIf everything is fine I can write the documentation. |
|
I'd prefer the constructor to be more targeted and the output simpler:
Render as: |
|
Hi, I've changed the constructors and error messages as requested. Is this change still going to be implemented? Please don't hesitate to mention any issue with the code. Ping (1/3) |
|
Yes! I do plan to merge this. But I'm holding off a bit, because this is an API change that would require a major version bump, and I want to make sure we don't need more point releases for 2.11 first. I'll make a couple very minor comments, but this is looking good. |
| "setext" -> pure HeadingFormatSetext | ||
| "atx" -> pure HeadingFormatAtx | ||
| _ -> E.throwIO $ PandocOptionError $ T.pack | ||
| ("Unknown markdown heading format: " ++ arg) |
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.
Add: "expecting setext or atx"?
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 used your proposed message. Another one I thought was: "Valid options are: setext and atx". Both messages convey the same information.
src/Text/Pandoc/App/Opt.hs
Outdated
| , optSlideLevel :: Maybe Int -- ^ Header level that creates slides | ||
| , optSetextHeaders :: Bool -- ^ Use atx headers for markdown level 1-2 | ||
| -- | Heading style for markdown level 1-2 | ||
| , optMarkdownHeadingFormat :: MarkdownHeadingFormat |
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.
Instead of the comment on line 134, put a comment on line 135 using -- ^ as above.
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.
Done. I was thinking about the 80 char line width guideline. Also I was trying to avoid modifying the spacing before the '::'s.
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 sorry to reverse myself on this, but on reflection, I think that it's a bad idea to break the public API for aesthetic reasons. Let's just keep optSetextHeaders and use that. Everything else can stay the same, and then we can integrate this change without a breaking API change.
Also, is it possible to rebase your changes on master so that they are easier to integrate, and possibly collapse them into a small number of commits?
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 think that it's a bad idea to break the public API for aesthetic reasons. Let's just keep optSetextHeaders and use that.
I'm not sure I understand what you mean.
In this patch
atx-headingsare the new default markdown headings.--atx-headersis deprecated.--markdown-headings=setext|atxis the new way of controlling the markdown headings.
Did you mean to revert any of those or keeping those but implement them using optSetextHeaders?
I added the optMarkdownHeadingFormat to better reflect the new flag --markdown-headings and the yaml config in the implementation. So if one were to ask: "How does --markdown-headings=setext|atx works?" the answer is easier(in my opinion) to find. I agree it's a big departure from the previous API (optSetextHeaders is now optMarkdownHeadingFormat == HeadingFormatSetext).
Also, is it possible to rebase your changes on master so that they are easier to integrate, and possibly collapse them
into a small number of commits?
I'll see if I can to collapse some commits on test cases.
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 guess what I had in mind was avoiding the switch from optSetextHeaders to optMarkdownHeadingFormat. That change would require a bump to 2.12.
I'm actually sort of conflicted on this. I'm not ready to go to 2.12 yet, but otherwise we could merge this change. On the other hand, the change does improve clarity. (There may also be ramifications for the JSON and YAML instances that I'm not thinking of.)
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.
In any case, collapsing to a small number of commits makes it easier to rebase in the future.
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 can't remember whether your changes included also a change to writerSetextHeaders in WriterOptions.
Seems to me that if we're going to make a big API change, we might consider changing that as well as optSetextHeaders.
But maybe the principle of avoiding API changes except when necessary favors just leaving these types as they are?
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.
Very well, I'll keep optSetextHeaders and make --markdown-headings=setext|atx modify it accordingly.
|
Note: any changes in the public-facing API should be marked as "[API change]" in the commit messages. This would include new constructors for exported types, new fields in exported record types, etc. If this isn't marked in commit messages, I may forget to note it in the changelog. |
Working on #6662
First step