-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Rewrite formatting help section db seed in Markdown #988
base: develop
Are you sure you want to change the base?
Rewrite formatting help section db seed in Markdown #988
Conversation
I can't find a reason not to make this change, but to double check I've posted on Collab: Do seed posts need to be HTML rather than Markdown? |
These sound like good changes. I haven't pulled it yet to take a closer look; just a couple things based on your summary. I've asked in Discord about the reasons for help being HTML, just in case there's some barrier to converting at all. (Edited to add: thanks for asking this on Collab.) I'd rather keep the Proper heading semantics (1, 2, 3, no skips) sounds like a win to me. I don't care if the text is a little bigger; it might make the page easier to scan. |
I was wrong. I thought that ids would be automatically inserted by the Markdown renderer, but it seems not. On GitHub, Markdown files have automatic ids for every heading level, but apparently that's a GitHub thing rather than a Markdown thing. Options I can see:
I'm not fond of the first 2 options (for the inconsistency), but they would work. I'd possibly be comfortable with option 3 if we could be reasonably sure there were very few links or that they were only to short documents (maybe if we could run a regex over the database to find links with a Are you solely concerned about existing links, or would you still want the potential even if no links had been made yet? |
I'm concerned about existing links, not so much future ones, but you're right that the page would still load so they're only half-broken. (It would be nice to have in-page anchors, something that's been requested for headings within regular posts too, but that's a larger issue. If that happens then I hope whatever the solution is would work for help too, but we don't need to block on "somebody might want to direct-link this section".) |
AFAIK, seeds still need to be written in HTML so that they seed and render correctly. @trichoplax sounds like you've found different here, can you confirm? |
@ArtOfCode- At the time of writing I had tested this in development for the Formatting help page only. I've now tested for a few others, and discovered a subtlety I had missed previously (in bold italics below). The following have been true for each help page I have tested so far:
Note that the filename still ends I don't know why the presence of non-HTML content blocks the seeds from updating the help pages, but only after a user edit. If there isn't a good reason for this behaviour, should it be considered a bug? If fixed it looks like it would allow all the help pages to be in Markdown and easily editable. |
@trichoplax IIRC that's intended behaviour - if a help file has been edited by a community, we deliberately don't apply any seeded updates to it to avoid overwriting community-specific changes. Sounds like that's working as intended. Also sounds like replacing everything with Markdown does actually work. |
(I posted this one before seeing your reply) In the meantime, does this need to block this pull request?
|
Ah I see. Then in that case the bug is that the prevention of overwriting community-specific changes is broken when the community-specific changes are solely HTML. |
Agree. No need to block this PR, then - has conflicts but once those are resolved this can be merged. |
I got a little lost in the thread, but it sounds like this change will not cause overwrites of locally-modified help, right? I know at least one of our communities has heavily revised the help and others have made smaller changes, and we don't know what other deployments might be doing. |
@ArtOfCode- I've fixed the merge conflict but please hold off merging pending @cellio's concern. If a community has made edits through the user interface, and if they have kept strictly to only using HTML, then it seems that their changes would be overwritten by I guess we can either:
I'd lean towards holding off rather than have to think about other instances we might not know about (and therefore can't warn) getting unexpected data loss. |
I'd lean toward holding off, too. Is there an issue for the other bug? If not, could you create one @trichoplax? |
I've raised #992 and changed this pull request to a draft until the bug is fixed. |
Fixes several places where the rendered output is incorrect in the Formatting section of the help, and converts the whole database seed file to Markdown to reduce the risk of future errors and make the help section editable by non-technical site admins.
Running
UPDATE_POSTS=true rails db:seed
in my local dev environment successfully pulled through the Markdown into the Formatting section of the help, and the output was correctly rendered.Prompted by the subtle bug highlighted by #986 - surplus blank lines are appearing due to the HTML and Markdown renderers having a difference of opinion. I'll omit the details of why, unless requested, because they become irrelevant once the file is Markdown only.
Since converting all the HTML to Markdown makes the diff useless, I've described below those changes that go beyond simply representing the same thing in Markdown.
Links section
Headings section
Changes that do not affect appearance
id
attributes from the headings.Markdown will create these automatically, but with slightly different names.(This is not the case - I was confusing general Markdown with how Markdown is rendered on GitHub.) This will only be a problem if they have been linked to from elsewhere (there are no internal links to break).Changes that do affect appearance, but that I anticipate being acceptable
<h3><strong>
headings with##
headings, which render as<h2>
. This avoids the semantic problem of skipping<h2>
(the post title will be<h1>
), and avoids the use of the semantic<strong>
tag in a context it was not intended for. This should make the page easier to parse for screen readers. The visual result is slightly larger section headings.