Skip to content

Configuration

step- edited this page Dec 7, 2024 · 1 revision

Configuration

MDVIEW MTX does not have a configuration file per se; all features can be set using command-line options. If you frequently use the same options and wish for a configuration file, consider using the MDVIEW_OPTIONS environment variable instead. You can set and export MDVIEW_OPTIONS in your shell configuration file (e.g., .bashrc, .zshrc) or in your shell profile (e.g., .profile), adding commonly used options to the variable as you would write them on the command line.

Viewer Fonts

Mdview loads its user-interface fonts using the fontconfig font engine, which can be configured precisely according to the information in the fontconfig manual. Below, I have compiled a sample fontconfig configuration to change the font name and size displayed by mdview.

  1. Save the sample configuration to file ~/.config/fontconfig/conf.d/90-mdview.conf.

  2. Modify the font family names to reflect you favorite fonts, which must be already installed in your system.

  3. Settings take effect when you restart mdview.

  4. To debug your settings you can use the FC_DEBUG environment variable:

    FC_DEBUG=1024 mdview /path/to/my-file.md
    

Please note that fontconfig cannot change font colors.

Sample fontconfig configuration

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<description>My mdview fontconfig</description>
  <match> <!-- Sans font -->
    <test name='prgname'><string>mdview</string></test>
    <test name='family' compare='contains'><string>sans</string></test>
    <test name='family' compare='not_contains'><string>mono</string></test>
    <!-- my fallback font -->
    <edit name='family' mode='prepend' binding='strong'><string>DejaVu Sans</string></edit>
    <!-- my font -->
    <edit name='family' mode='prepend_first' binding='strong'><string>Symbola</string></edit>
  </match>
  <match> <!-- Monospace font -->
    <test name='prgname'><string>mdview</string></test>
    <test name='family' compare='contains'><string>mono</string></test>
    <edit name='family' mode='prepend' binding='strong'><string>DejaVu Sans</string></edit>
    <edit name='family' mode='prepend_first' binding='strong'><string>Liberation Mono</string></edit>
  </match>
  <!-- Font size: 115% -->
  <match target='font'>
    <test name='prgname'><string>mdview</string></test>
    <edit mode='assign' name='matrix'>
      <times>
        <name>matrix</name>
        <matrix>
          <double>1.15</double><double>0</double>
          <double>0</double><double>1.15</double>
        </matrix>
      </times>
    </edit>
  </match>
</fontconfig>

Page metadata

See XML metadata.

Clone this wiki locally