-
Notifications
You must be signed in to change notification settings - Fork 341
Preserve HTML entities in headers #2122
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: main
Are you sure you want to change the base?
Conversation
cc @garazdawi |
📦 Docs artifacts are ready: https://github.com/elixir-lang/ex_doc/actions/runs/14911198110/artifacts/3087777715 |
Btw, I think this is going to have some subtle issues, as we are using two different ways to compute headers (one using regexes and another without), so we may need to look into that before shipping this. |
Tested it for us and it solves the issue and I haven't found any regressions so far :) |
@garazdawi please check again! I made a big refactoring that unified how we handle link headings, so we only do it once in a single place, using DocAST instead of relying too much on regexes. |
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.
Seems to work fine except for the small detail in map_tags
.
def map_tags({tag, attrs, inner, meta}, fun), | ||
do: fun.({tag, attrs, Enum.map(inner, &map_tags(&1, fun)), meta}) |
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.
def map_tags({tag, attrs, inner, meta}, fun), | |
do: fun.({tag, attrs, Enum.map(inner, &map_tags(&1, fun)), meta}) | |
def map_tags({tag, attrs, inner, meta}, fun) when is_list(inner), | |
do: fun.({tag, attrs, Enum.map(inner, &map_tags(&1, fun)), meta}) | |
def map_tags({tag, attrs, inner, meta}, fun), | |
do: fun.({tag, attrs, inner, meta}) |
When edoc is used to generate the doc ast, inner can be a string without being wrapped in a list.
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 basically wrote all of the traversal functions assuming that the contents is a list. :( Any chance we could normalize edoc in the long term? I will also improve the traversal functions here meanwhile.
Maybe you could normalize the input in the retriever?
yes, I think that it is a mistake that it is like that today. I'm surprised that our own validators do not catch it... |
Closes #2114.
Closes #2120.