Write, share, and publish documents with HedgeDoc
Special Formatting
In addition to regular text, HedgeDoc lets you format source code, emojis, and images using Markdown syntax. To format software code, you use three backticks (```) at the beginning and end of a code block. The code will be highlighted according to the language used. For emojis, you type : at the beginning of the line. An ! at the beginning of a line tells HedgeDoc to insert the code to embed an image in that position.
When embedding an image, its source location affects how HedgeDoc embeds the image. If the image is already online (on the same or another server), you just insert the image's URL in the Markdown code that HedgeDoc auto-inserts after the exclamation mark. If the image is on your computer, click on the Upload Image button in the toolbar and upload the image to the HedgeDoc server (or to an alternative location as described in the "Self-Hosting" section). Alternatively, you may drag and drop an image from your file manager directly to where you want it to appear in the note.
At time of writing, HedgeDoc 1.8.2 still lets you embed YouTube videos, as follows:
{%youtube ID_NUMBER_OF_YOUTUBE_VIDEO %}
However, this specific markup is officially deprecated. It should soon be replaced by embedding "plain links" (the meaning of which is currently unclear).
Metadata
Similar to most Markdown-capable applications, HedgeDoc supports adding metadata to files to set browser behavior. For the metadata to be recognized, it must be placed in a special section, called "frontmatter," at the beginning of each file.
You use YAML to format the frontmatter. The syntax to mark the start of the frontmatter is three dashes, and three dashes mark the end of the frontmatter. The YAML metadata goes inside, with one key/value pair on each line, separated by a colon, as follows:
--- title: real title tags: tutorial, open source, writing description: Another useful tutorial robots: nofollow ---
HedgeDoc will use the title
value as the HTML note's title, overriding the first level 1 heading (which would be used if there were no metadata). These tags can be used by any system (including search engines) that catalogs the notes by topic. The values of the description
and robots
keys will be added in the HTML note's header, to make search engines properly index the note and the links it contains. However, you can set robots
to noindex
if you don't want the page indexed. Set robots
to nofollow
if you do not want the pages linked from the current page to be indexed. In addition to these metadata tags, HedgeDoc recognizes many other tags. For more information, consult the documentation on HedgeDoc's website [2].
Diagrams and Mathematical Expressions
In addition to text, source code, and images, HedgeDoc can also format diagrams and charts, as well as complicated mathematical expressions. In my PlantUML tutorial [4], for example, I showed how to create a sequence diagram out of a text file as shown in Listing 1.
Listing 1
PlantUML Sequence Diagram Format
01 @startuml 02 Alice -> Bob : Hello, is the store open? 03 Bob -> Alice: Yes, it is. What do you want to buy? 04 Alice -> Bob : I want to buy some jeans. 05 Alice <- Bob : Please tell me the color. 06 Alice -> Bob : Black 07 Alice <- Bob : Now please tell me the size. 08 Alice -> Bob : 42 09 @enduml
With HedgeDoc, you can obtain the same results by inserting sequence diagram text, but you use ```sequence
at the beginning instead of @startuml
and ```
at the end instead of @enduml
, as shown in Listing 2.
Listing 2
HedgeDoc Sequence Diagram Format
```sequence Alice->Bob: Hello, is the store open? Bob->Alice: Yes, it is. What do you want to buy? Alice->Bob: I want to buy some jeans. Bob->Alice: Please tell me the color. Alice->Bob: Black Bob->Alice: Now please tell me the size. Alice->Bob: 42 ```
The sequence
keyword following the backticks at the beginning of Listing 2 is what actually creates the diagram shown in Figure 7. If you left sequence
out, HedgeDoc would treat the diagram text as source code. To learn about all the diagram types that HedgeDoc supports, see the many examples available online [5].
![](/var/linux_magazin/storage/images/issues/2021/252/markdown-magic/figure-7/793598-1-eng-US/Figure-7_large.png)
HedgeDoc also supports mathematical expressions by using the MathJax library [6]. MathJax reads plain text descriptions in MathML, LaTeX, or AsciiMath formats and renders them as complex mathematical expressions. Depending on the situation, the expression is rendered using a combination of HTML code with special CSS stylesheets, web fonts, MathML code, or scalable vector graphics (SVG).
Because MathJax support is built into HedgeDoc, you can easily enter a mathematical expression in any of the source formats and immediately see how it looks. Figure 8 demonstrates the rendered expression from the LaTeX expressions shown in Listing 3.
Listing 3
LaTeX Expressions
$$\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}$$ $$\int_{a}^b\int_{c}^d f(x,y)dxdy$$
![](/var/linux_magazin/storage/images/issues/2021/252/markdown-magic/figure-8/793601-1-eng-US/Figure-8_large.png)
The value HedgeDoc offers in rendering mathematical expressions can't be overestimated. Math students and teachers worldwide have been using LaTeX formulas for years, with thousands of expressions scattered inside countless LaTeX files. HedgeDoc offers an easy way to write and publish any paper based on these formulas.
« Previous 1 2 3 4 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.