Skip to content

Conversation

@svalentin
Copy link
Collaborator

@svalentin svalentin commented Jan 16, 2025

Toe get highlighting to work, we just need to import the CSS and run the highlight.js that does the highlighting in JS client side. We can add the lines at the top of the blog post to do this. I've made it only support bash and python for now to help with detection. But if we have a reason to, we can remove that and let it try them all.
In a previous PR I've added the necessary <code> tags.

Since we're highlighting nicely now, I also removed the extra indendation.

I've also noticed that we're pretty good at specifying the language in code blocks in the changelog. So we can take that language and use it in the code block as a class to tell highlight.js exactly what language that code block is in.
If this is useful, we can remove the limitation of only python and bash support from the top configuration in the future.
This is useful for smaller blocks of a few lines where maybe it doesn't detect the language properly.

Used on mypy 1.14 blog post - https://mypy-lang.blogspot.com/2024/12/mypy-114-released.html

Toe get highlighting to work, we just need to import the CSS and run the
highlight.js that does the highlighting in JS client side.
We can add the lines at the top of the blog post to do this.
I've made it only support bash and python for now to help with
detection. But if we have a reason to, we can remove that and let it try
them all.
In a previous PR I've added the necessary <code> tags.

But since we're highlighting nicely now, we can just remove the extra
indendation.

I've also noticed that we're pretty good at specifying the language in
code blocks in the changelog. So we can take that language and use it in
the code block as a class to tell highlight.js exactly what language
that code block is in.
If this is useful, we can remove the limitation of only python and bash
support from the top configuration in the future.
This is useful for smaller blocks of a few lines where maybe it doesn't
detect the language properly.
@svalentin svalentin requested a review from JukkaL January 16, 2025 15:30
@JukkaL JukkaL merged commit 21156fd into python:master Jan 16, 2025
12 checks passed
@svalentin svalentin deleted the blog-html-code branch January 17, 2025 12:48
x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 2025
…18480)

Toe get highlighting to work, we just need to import the CSS and run the
highlight.js that does the highlighting in JS client side. We can add
the lines at the top of the blog post to do this. I've made it only
support bash and python for now to help with detection. But if we have a
reason to, we can remove that and let it try them all.
In a previous PR I've added the necessary `<code>` tags.

Since we're highlighting nicely now, I also removed the extra
indendation.

I've also noticed that we're pretty good at specifying the language in
code blocks in the changelog. So we can take that language and use it in
the code block as a class to tell highlight.js exactly what language
that code block is in.
If this is useful, we can remove the limitation of only python and bash
support from the top configuration in the future.
This is useful for smaller blocks of a few lines where maybe it doesn't
detect the language properly.

Used on mypy 1.14 blog post -
https://mypy-lang.blogspot.com/2024/12/mypy-114-released.html
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.

2 participants