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

Handle language tag on code blocks #848

Merged
merged 1 commit into from
Jun 8, 2022
Merged

Conversation

Julow
Copy link
Collaborator

@Julow Julow commented Mar 11, 2022

Pass the language tag through the model and to highlightjs in the html generator. The value is ignored in other backends.
Code blocks with no language specified are rendered as before (highlighted).

Highlightjs should recognize plain, plaintext and text to disable highlighting but perhaps we should have a string specific to Odoc that we can document and handle specifically ?

The version of highlightjs vendored only support one language (OCaml) and is not updated in this PR.

@Drup
Copy link
Contributor

Drup commented Mar 15, 2022

Nice, I've been wanting to do something like that for a while.

It should be used for the latex backend as well (but @Octachron knows better if that's complicated or not, it depend on the underlying macros).

Pass the language tag through the model and to highlightjs in the html
generator.
The value is ignored in other backends.
@dbuenzli
Copy link
Contributor

dbuenzli commented Jun 8, 2022

Code blocks with no language specified are rendered as before (highlighted).

I think they should rather default to ocaml, that's a reasonable default for the ocamldoc language.

Also would fix #759.

@jonludlam
Copy link
Member

I think we should address changing of currently existing defaults in a separate issue/PR.

@jonludlam jonludlam merged commit ed06c66 into ocaml:master Jun 8, 2022
@dbuenzli
Copy link
Contributor

dbuenzli commented Jun 8, 2022

That's not really changing a default, that's actually getting on par with ocamldoc generated docsets most of which always used the --colorize-code option, including the stdlib one.

mseri pushed a commit to ocaml/opam-repository that referenced this pull request Dec 13, 2022
CHANGES:

Additions
- New unstable option `--as-json` for the HTML renderer that emits HTML
  fragments (preamble, content) together with metadata (table of contents,
  breadcrumbs, whether katex is used) in JSON format. (@sabine, ocaml/odoc#908)
- New maths support via `{m ... }` and `{math ... }` tags. (@giltho, @gpetiot, ocaml/odoc#886)
- Various optimisations (@jonludlam, ocaml/odoc#870, ocaml/odoc#883)
- Better handling of alerts and deprecation notices. (@panglesd, ocaml/odoc#828)
- Handle language tags on code blocks (@Julow, ocaml/odoc#848)

Bugfixes
- Shadowing issues (@jonludlam, ocaml/odoc#853)
- Layout fixes and improvements (@panglesd, ocaml/odoc#832, ocaml/odoc#839, ocaml/odoc#847)
- Handle comments on class constraints and inherit (@Julow, ocaml/odoc#844)
- Disable the missing root warning (@jonludlam, ocaml/odoc#881)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants