Okular has problems detecting Markdown files. For example (adapted from https://bugs.kde.org/show_bug.cgi?id=430538#c9) the following two files, for which only the second one is rendered as Markdown (Okular 21.12.3, Markdown backend 0.1.0 from okular-extra-backends
, Ubuntu 22.04 LTS):
File 1
### This is supposed to be a markdown document
Here are the properties that `mimetype` and `file` show for this file:
- `mimetype`: text/markdown
- `file --mime-type`: text/plain
- Open With: `Okular`
This file is opened in Okular with the Txt backend
File 2
# Add this line to change the backend
### This is supposed to be a markdown document
Here are the properties that `mimetype` and `file` show for this file:
- `mimetype`: text/markdown
- `file --mime-type`: text/plain
- Open With: `Okular`
This file is opened in Okular with the Markdown backend
Both are valid Markdown (there is no rule in the spec that you need to start with header level 1). However, the first file is rendered as plain text while the second file is rendered as Markdown.
Of course it would be nice if Okular would recognize Markdown more reliably (some obvious approaches for this come to mind) but my question until this happens:
Is it possible to manually select the backend that is used to open a file in Okular? Either from the terminal (something like okular --backend=markdown myfile.md
) or from the Okular GUI after the file is opened with the wrong backend? Or maybe the file properties for an individual file can be modified, or something system-wide regarding the process for reporting the mime type can be configured (assuming that file --mime-type
and Okular use the same underlying process) to convince Okular to use the Markdown backend?