Skip to content
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

Do not render hl_style as an HTML attribute #9390

Closed
jmooring opened this issue Jan 15, 2022 · 7 comments · Fixed by #9391
Closed

Do not render hl_style as an HTML attribute #9390

jmooring opened this issue Jan 15, 2022 · 7 comments · Fixed by #9391
Assignees
Milestone

Comments

@jmooring
Copy link
Member

The yuin/goldmark-highlighting module accepts the following attributes: linenos, linenostart, hl_lines, and hl_style.

For example:

```bash {linenos=table linenostart=4 hl_lines=["4-6",9] hl_style=emacs}
#!/usr/bin/env bash

mul() {
  foo=$1
  bar=$2
  echo $((foo * bar))
}

mul 6 7
```

These attributes have special meaning, and should not be rendered as HTML attributes in the wrapping element.

We already do this for linenos, linenostart, and hl_lines. We just need to add hl_style to the list.

@kaushalmodi
Copy link
Contributor

From the docs, the variable for setting the style is just "style": https://gohugo.io/getting-started/configuration-markup#highlight

While this is being fixed, can you also make the attribute for highlighting style consistent between highlight shortcode and code fences?

@jmooring
Copy link
Member Author

@ While this is being fixed, can you also make the attribute for highlighting style consistent between highlight shortcode and code fences?

No. First, when using code fences, the syntax is determined by yuin/goldmark-highlighting. Second, even if we were able to somehow alias the option name, using style would be a poor choice because style is a standard HTML attribute, and you would end up with invalid CSS in the style attribute of the wrapping div.

@kaushalmodi
Copy link
Contributor

I meant using hl_style (and documenting only that) for the highlight shortcode and deprecating the style attribute there.

@jmooring
Copy link
Member Author

That's a separate issue, affecting the shortcode, the function, related tests, and documentation for each. If you feel strongly about it, create a new proposal.

@kaushalmodi
Copy link
Contributor

If you feel strongly about i

It's mainly to prevent user confusion. May be a table in the documentation would suffice that would compare the names and availability of various attributes for highlight shortcode vs the code fence style.

@jmooring
Copy link
Member Author

May be a table in the documentation

That's a separate issue. If you feel strongly about it, please create a new proposal in the documentation repository. Thanks.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants