# Language setting in Markdown notes

**URL:** <https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198>\
**Category:** Feedback\
**Created:** [July 16, 2024, 9:09am UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198 "2024-07-16T09:09:36Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![suavito](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@suavito](https://discourse.devontechnologies.com/u/suavito)\
**Post date:** [July 16, 2024, 9:09am UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198/1 "2024-07-16T09:09:36Z")

</div>

I’m writing notes in Markdown, mostly in German but also some in English. I’ve set my editor pane to a quite narrow column, so I’ve activated hyphenation in the style sheet for my Markdown notes. I use _DEVONthink_ with the English user interface.

And there lies the rub: _DEVONthink_ sets the language in the rendered Markdown to the language of the user interface. This means that the hyphenation in my German notes is kaputt.

As far as I know, there’s no way to set the language in CSS. I know there’s the `:language` pseudo-class, but it can only be used to style text in a certain language (like a special non-Latin font for the non-Latin parts of a text that otherwise is written in a language with Latin letters). The language is set in the HTML code, in the `<body>` tag, as the default, and in `<span>` or `<div>` for exceptions.

MultiMarkdown—again: to my knowledge—can contain a metadata called `Language:`, but it wouldn’t affect how it’s rendered in HTML. Is there any way of setting the language for Markdown notes, other than adding unelegantly and un-markdownily HTML code? Could _DEVONthink_ get a setting to at least set the default Markdown language independently of the user interface language?

---

<div class="post-metadata">

**Author:** ![chrillek](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/chrillek/32/29340_2.png) [@chrillek](https://discourse.devontechnologies.com/u/chrillek)\
**Post date:** [July 16, 2024, 9:30am UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198/2 "2024-07-16T09:30:07Z")

</div>

> [@suavito](#):
>
> As far as I know, there’s no way to set the language in CSS.

Correct. And “of course” 😉 CSS is about style, not content.

> [@suavito](#):
>
> MultiMarkdown—again: to my knowledge—can contain a metadata called `Language:`, but it wouldn’t affect how it’s rendered in HTML

Unfortunately, it does exactly zilch. Nothing. _Why_ would be a question for @cgrunenberg or @BLUEFROG.

The HTML generated by the MMD processor in DT is quite rudimentary in that it doesn’t contain any `lang` setting at all in the `html` element. It _should_ do, [in my opinion](https://discourse.devontechnologies.com/t/html-generated-from-markdown-should-set-lang-attribute/79782)

> [@suavito](#):
>
> other than adding unelegantly and un-markdownily HTML code?

Even that won’t help you. The `lang` attribute must be set on an element, preferably _the_ `html` element. But you can’t include a `html` element in your MD file. Nor any other element that would set the `lang` correctly for the whole document.

Perhaps the power that be (@cgrunenberg?) could do something about it?

**Edit** Here’s what you _could_ do (and I admit upfront that it’s at best a nasty workaround, not a solution).  
Create a JavaScript file (say “lang.js”), save that somewhere, and add it to the `JavaScript` part of DT’s markdown setting.

```javascript
  document.addEventListener('DOMContentLoaded', () => {
     const htmlEl = document.querySelector('html');
     html.lang = 'de';
  })

```

You can also add this code inside a `script` element at the top of a MD file to see if/how it works.  
This will set the `lang` attribute to “de” in the `html` element. It does so, however, _after_ the document has finished loading. So, I can’t promise that this will cause the hyphenation to be modified. Give it a try.

---

<div class="post-metadata">

**Author:** ![cgrunenberg](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/cgrunenberg/32/7172_2.png) [@cgrunenberg](https://discourse.devontechnologies.com/u/cgrunenberg)\
**Post date:** [July 16, 2024, 9:43am UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198/3 "2024-07-16T09:43:18Z")

</div>

> [@chrillek](#):
>
> Perhaps the power that be (@cgrunenberg?) could do something about it?

Is there a common Markdown syntax for this?

---

<div class="post-metadata">

**Author:** ![suavito](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@suavito](https://discourse.devontechnologies.com/u/suavito)\
**Post date:** [July 16, 2024, 9:53am UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198/4 "2024-07-16T09:53:12Z")

</div>

The metadata section of the MultiMarkdown 6 syntax guide only contains of this:

```auto
 Title:	This is a title
 Author:	Fletcher T. Penney
 HTML Header: 

```

Maybe the `HTML Header` part could be of any use?

---

<div class="post-metadata">

**Author:** ![chrillek](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/chrillek/32/29340_2.png) [@chrillek](https://discourse.devontechnologies.com/u/chrillek)\
**Post date:** [July 16, 2024, 9:57am UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198/5 "2024-07-16T09:57:27Z")

</div>

There is a metadata item in the [MMD6 specification](https://fletcher.github.io/MultiMarkdown-6/MMD_Users_Guide.html#language). I can’t test if that does what it says it would do, though. But what I _expect_ is this:

- set `language: de_DE` in the MD header
- have `<html lang="de_DE"...` in the rendered HTML

That would at least allow a language setting _per_ Markdown file. A better approach might be to set the language in the `html` element from the user’s locale:

- If there’s no `language: ` in the MD header, use the user’s locale setting
- If there is a `language:` in the MD header, use that instead.

Even more sophisticated would be separate locale setting for MD files in the DT preferences 😉 That way, users could override the system wide settings in DT and the DT settings in individual MD files.

Just dreaming …

---

<div class="post-metadata">

**Author:** ![cgrunenberg](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/cgrunenberg/32/7172_2.png) [@cgrunenberg](https://discourse.devontechnologies.com/u/cgrunenberg)\
**Post date:** [July 16, 2024, 10:01am UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198/6 "2024-07-16T10:01:31Z")

</div>

> [@chrillek](#):
>
> Even more sophisticated would be separate locale setting for MD files in the DT preferences 😉

There are already way too many options and we try to avoid adding even more unless there’s a common need for it (as more options make support more difficult and do not simplify the learning curve for new users).

---

<div class="post-metadata">

**Author:** ![suavito](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@suavito](https://discourse.devontechnologies.com/u/suavito)\
**Post date:** [July 16, 2024, 10:14am UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198/7 "2024-07-16T10:14:02Z")

</div>

> [@cgrunenberg](#):
>
> There are already way too many options and we try to avoid adding even more unless there’s a common need for it (as more options make support more difficult and do not simplify the learning curve for new users).

Understandable, but I’d say it’s not just me but there actually is a common need for proper hyphenation (and quotes) in Markdown notes.

---

<div class="post-metadata">

**Author:** ![suavito](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@suavito](https://discourse.devontechnologies.com/u/suavito)\
**Post date:** [July 16, 2024, 10:19am UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198/8 "2024-07-16T10:19:53Z")

</div>

Interestingly, Fletcher Penney’s (the inventor of MultiMarkdown) own _MultiMarkdown Composer_ does ignore the `hyphen: auto` setting, so I can’t test the `language: de_DE` setting.

It doesn’t do anything in _DEVONthink_. _Marked_ on the other hand hyphenates correctly _without_ any language setting. (It might take the user interface language of macOS as a default though; I won’t check that by switching the whole OS language, at least for the time being.)

---

<div class="post-metadata">

**Author:** ![cgrunenberg](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/cgrunenberg/32/7172_2.png) [@cgrunenberg](https://discourse.devontechnologies.com/u/cgrunenberg)\
**Post date:** [July 16, 2024, 10:22am UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198/9 "2024-07-16T10:22:00Z")

</div>

> [@chrillek](#):
>
> - If there’s no `language: ` in the MD header, use the user’s locale setting
> - If there is a `language:` in the MD header, use that instead.

The next release will support this.

---

<div class="post-metadata">

**Author:** ![suavito](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@suavito](https://discourse.devontechnologies.com/u/suavito)\
**Post date:** [July 16, 2024, 10:49am UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198/11 "2024-07-16T10:49:10Z")

</div>

Great (as always)!

Of course, like I said, I would prefer if the default language would be independent from the UI setting. But I can work with this solution. Sounds like a job for a script to add the language metadata to existing Markdown notes.

---

<div class="post-metadata">

**Author:** ![suavito](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/s/f475e1/32.png) [@suavito](https://discourse.devontechnologies.com/u/suavito)\
**Post date:** [April 12, 2025, 5:50pm UTC](https://discourse.devontechnologies.com/t/language-setting-in-markdown-notes/80198/12 "2025-04-12T17:50:30Z")

</div>

Sorry for bumping this up.

But based on about a year with adding the language metadata to my markdown notes I would like to state that it is less than ideal. And that is for the simple reason that I use the notes very often later on in other apps which can’t handle the metadata and just show it as normal text. Which I then have to remove manually.

So my little wish for the shiny new _DEVONthink 4_: a setting for the content language. There is a setting for the transcription language, there is a setting for the Ruler (which is at least partially language/area related), and in my opinion there should be a setting for the editing language, probably in `Editing/General`.
