Markup the article language

Open
#240 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start by locating the implementation of the .. post:: directive and the template that generates <div class="body" role="main">; inspect how :language: and the surrounding <html> language are currently handled. Build or test a post whose language differs from the site language and verify that the generated post body has the requested language attribute.

Written by the indexing model from the issue text.

Description

Enhancement Help Wanted
Describe the feature

The <html> element has a lang attribute for the whole page/site but the blog post text doesn't have its own attribute. Which is fine if the blog post is in the language of the site, but it may break things if it is not.

For instance my blog is in English for all but one blog post which I marked as German (de) in the .. post:: directive. As Sphinx's basic.css allows the browser to automatically hyphenate text, the wrong rules for hyphenation are used in that German post.

Proposed solution

Extend the <div class="body" role="main"> with a lang attribute with the value given with :language: in the post, at least if it differs from the one in the <html> element.

Dominant language
Python
Stars
196
Forks
64
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sunpy/ablog

All issues in sunpy/ablog

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.