ComdTeX

Reglas de carpeta

Una carpeta puede llevar sus propias convenciones: con qué plantilla arrancan sus notas, cómo se nombran, qué frontmatter traen por defecto, y qué vistas (tareas, calendario, índice) se generan a partir de ellas. Pensado para el caso “una carpeta por materia”: abres la carpeta, creas una nota, y ya viene con la plantilla, el nombre con fecha y el campo de materia puestos.

Dónde viven las reglas

En un archivo .comdtex-folder.json dentro de la propia carpeta. Empieza por punto, así que ComdTeX lo oculta del árbol de archivos y de la búsqueda del vault; lo ves desde el gestor de archivos del sistema y viaja con la carpeta si la mueves o la subes a git.

mi-vault/
  algebra/
    .comdtex-folder.json      ← las reglas de esta carpeta
    2026-03-04-derivadas.md
    2026-03-11-integrales.md
    _tareas.md                ← generado

Se crean con clic derecho sobre la carpeta → Reglas de la carpeta…. Ninguna sección es obligatoria: puedes usar solo el patrón de nombre, o solo los archivos generados.

Los cuatro campos

Plantilla por defecto

Qué contenido trae una nota nueva creada en esta carpeta, elegida de la lista de plantillas de fábrica y las tuyas. Si creas la nota con Nuevo desde plantilla… y eliges una a mano, esa elección gana: la de la carpeta solo se aplica cuando no dices otra cosa.

Patrón de nombre

Cómo se nombra el archivo a partir de lo que escribes. Con el patrón {{date:YYYY-MM-DD}}-{{title}}, teclear derivadas crea 2026-03-04-derivadas.md. Si escribes la extensión (derivadas.md), se respeta.

Variables disponibles:

VariableResultado
{{title}}Lo que escribiste
{{date}}2026-03-04
{{date:YYYY-MM-DD}}Fecha con formato propio (YYYY, MM, DD, HH, mm, ss)
{{year}}2026
{{time}}15:42

Frontmatter por defecto

Claves YAML que se añaden al frontmatter de las notas nuevas, por ejemplo materia: Álgebra II y tags: ["algebra"]. Solo se añaden las claves que el documento no defina ya: si la plantilla trae su propio title:, el de la carpeta no lo pisa.

Archivos generados

Vistas construidas a partir de las notas de alrededor. Ver la sección siguiente.

Herencia

Las subcarpetas heredan campo a campo, y gana la carpeta más cercana:

mate/            defaultTemplate: "clase"     frontmatter: {profesor: Ruiz}
mate/algebra/    filenamePattern: "{{date}}-{{title}}"

Una nota creada en mate/algebra/ usa la plantilla clase (heredada), el patrón de nombre de algebra, y profesor: Ruiz (heredado).

Los archivos generados NO se heredan. Nombran un archivo concreto dentro de la carpeta que los declaró; si se heredasen, cada subcarpeta acabaría con una copia del índice del padre.

Archivos generados

Se declaran en el diálogo de reglas con tres campos: nombre del archivo, tipo y alcance.

TipoQué produce
TareasTodas las - [ ] agrupadas por archivo, con enlace [[nota]], pendientes primero y un recuento arriba
CalendarioLas notas agrupadas por mes y fecha, de más reciente a más antigua
ÍndiceLista alfabética de las notas con su título

El alcance es Solo esta carpeta (por defecto) o Todo el vault. La fecha de una nota para el calendario sale de su frontmatter date: o del prefijo del nombre (2026-03-04-clase.md); las que no tienen fecha se agrupan al final bajo Sin fecha, no se descartan.

Cómo se regeneran

No es automático. Se ejecuta cuando tú lo pides, desde Menú Vault → Regenerar archivos de carpeta o Ctrl+P → “Regenerar archivos de carpeta”. Regenera las reglas de la carpeta del archivo que tengas abierto.

La protección contra sobrescritura

Cada archivo generado empieza así:

<!-- comdtex:generated -->
<!-- Este archivo se regenera automáticamente. Los cambios manuales se perderán. -->

ComdTeX solo sobrescribe un archivo si está vacío o si lleva esa marca. Si borras la marca y escribes ahí, la regeneración se salta ese archivo y te avisa, en vez de destruir lo que escribiste. Es la vía para “adoptar” un archivo generado y hacerlo tuyo.

Formato del archivo, para editarlo a mano

{
  "version": 1,
  "defaultTemplate": "clase",
  "filenamePattern": "{{date:YYYY-MM-DD}}-{{title}}",
  "frontmatter": {
    "materia": "Álgebra II",
    "tags": ["algebra"]
  },
  "generated": [
    { "file": "_tareas.md", "type": "tasks", "scope": "folder" },
    { "file": "_calendario.md", "type": "calendar", "scope": "folder" }
  ]
}

El parser es tolerante: una entrada mal escrita se descarta y el resto se aplica igual. Un file con /, \ o .. se rechaza: un archivo generado no puede escribir fuera de su propia carpeta.

Folder rules

A folder can carry its own conventions: the template its notes start from, how they are named, what frontmatter they get by default, and what views (tasks, calendar, index) are generated from them. Built for the “one folder per subject” case: open the folder, create a note, and it already arrives with the right template, a dated filename and the subject field filled in.

Where the rules live

In a .comdtex-folder.json file inside the folder itself. It starts with a dot, so ComdTeX hides it from the file tree and from vault search; you see it from your system’s file manager, and it travels with the folder if you move it or push it to git.

my-vault/
  algebra/
    .comdtex-folder.json      ← this folder's rules
    2026-03-04-derivatives.md
    2026-03-11-integrals.md
    _tasks.md                 ← generated

Created via right-click on the folder → Folder rules…. No section is required: you can use only the filename pattern, or only the generated files.

The four fields

Default template

What content a new note created in this folder starts with, chosen from the list of built-in templates and your own. If you create the note with New from template… and pick one by hand, that choice wins: the folder’s default only applies when you don’t say otherwise.

Filename pattern

How the file is named from what you type. With the pattern {{date:YYYY-MM-DD}}-{{title}}, typing derivatives creates 2026-03-04-derivatives.md. If you type an extension (derivatives.md), it is respected.

Available variables:

VariableResult
{{title}}What you typed
{{date}}2026-03-04
{{date:YYYY-MM-DD}}Date with a custom format (YYYY, MM, DD, HH, mm, ss)
{{year}}2026
{{time}}15:42

Default frontmatter

YAML keys added to the frontmatter of new notes, for example subject: Algebra II and tags: ["algebra"]. Only keys the document doesn’t already define are added: if the template already has its own title:, the folder’s does not override it.

Generated files

Views built from the surrounding notes. See the next section.

Inheritance

Subfolders inherit field by field, and the nearest folder wins:

math/            defaultTemplate: "class"     frontmatter: {professor: Ruiz}
math/algebra/    filenamePattern: "{{date}}-{{title}}"

A note created in math/algebra/ uses the class template (inherited), algebra’s filename pattern, and professor: Ruiz (inherited).

Generated files are NOT inherited. They name a specific file inside the folder that declared them; if they were inherited, every subfolder would end up with a copy of the parent’s index.

Generated files

Declared in the rules dialog with three fields: filename, type and scope.

TypeWhat it produces
TasksAll - [ ] items grouped by file, with a [[note]] link, pending first and a count at the top
CalendarNotes grouped by month and date, most recent first
IndexAlphabetical list of notes with their title

Scope is This folder only (default) or Whole vault. A note’s date for the calendar comes from its frontmatter date: or from the filename prefix (2026-03-04-class.md); notes without a date are grouped at the end under No date, never dropped.

How they regenerate

Not automatic. It runs when you ask for it, from Vault menu → Regenerate folder files or Ctrl+P → “Regenerate folder files”. It regenerates the rules of the folder of the file you currently have open.

Overwrite protection

Every generated file starts with:

<!-- comdtex:generated -->
<!-- This file is regenerated automatically. Manual changes will be lost. -->

ComdTeX only overwrites a file when it is empty or still carries that marker. If you remove the marker and write there, regeneration skips that file and tells you so, instead of destroying what you wrote. That is how you “adopt” a generated file and make it yours.

File format, for hand-editing

{
  "version": 1,
  "defaultTemplate": "class",
  "filenamePattern": "{{date:YYYY-MM-DD}}-{{title}}",
  "frontmatter": {
    "subject": "Algebra II",
    "tags": ["algebra"]
  },
  "generated": [
    { "file": "_tasks.md", "type": "tasks", "scope": "folder" },
    { "file": "_calendar.md", "type": "calendar", "scope": "folder" }
  ]
}

The parser is tolerant: a malformed entry is dropped and the rest still applies. A file containing /, \ or .. is rejected: a generated file cannot write outside its own folder.