How to shallow clone a Cow

Rust's “copy on write” Cow abstraction is very useful to avoid costly cloning when dealing with vectors or strings. A Cow allows you to defer allocating new memory until it becomes inevitable. Consider the following example:

use std::borrow::Cow;
fn do_something_or_nothing(v: Cow<str>) -> Cow<str> {
    if v.len() > 3 {
        let s = "Hello ".to_string() + &*v;
        Cow::Owned(s)
    } else {
        v
    }
}

Tp-Note news: Multilingual note-taking with linguistic heuristics

Tp-Note's main design goal is to convert some input text - usually provided by the system's clipboard - into a Markdown note file with a descriptive YAML header and meaningful filename. This blog post explains how to configure Tp-Note for multilingual note-taking. Consider the following note file example:

---
title:    Demokratie und Menschenbild
subtitle: Vorlesung
author:   Prof. Rainer Mausfeld
date:     2023-04-21
lang:     de-DE
---

Kognitionswissenschaftliche Einsichten in die Beschaffenheit des Menschen.

The YAML variable lang: indicates the natural language in which the note text is authored, here de-DE. This IETF language tag is useful when working with grammar and spell checkers. For example: when placed in last position, the grammar checker LanguageTool (LTEX) reads the variable lang: to activate the grammar and spelling rules for the indicated specific language (c.f. blog post). The recently released Tp-Note version 1.21.0 integrates linguistic analysis provided by the Lingua library. This new feature allows Tp-Note to determine automatically the natural language of new note files during their creation process.

Tp-Note renders MathML and adds syntax highlighting

One downside when you take notes with your keyboard and laptop is, that you can not enter mathematical formulas.

To remedy this, Tp-Note version 1.19.8 comes with a new feature: its note viewer and internal web-server can now render MathML in note files written in Markdown. It also features syntax highlighting for source code.