Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

107
Vistas
Files With A Tag in ObsidianMD

I'm trying to write a plugin that fetches the list of files containing a particular tag (like "#condition") in ObsidianMD for some downstream purposes. The built-in global-search can do this already, and it seems like the metadataCache has some information about tags.

Further, the API appears to be able to getAllTags: https://github.com/obsidianmd/obsidian-api/blob/master/obsidian.d.ts#L1291, but I don't see any method that takes a tag and spits out a list of related files.

Does anyone know anything?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use app.vault.getMarkdownFiles() to get all markdown files in the current vault, then use getAllTags() on each file to filter those files which contain the tag. Example:

const tag = "#obsidian";
const cache = this.app.metadataCache;
const files = this.app.vault.getMarkdownFiles();
const files_with_tag = [] as TFile [];
files.forEach( (file) => {
    const file_cache = cache.getFileCache(file);
    const tags = getAllTags(file_cache);
    if (tags.includes(tag)) {
        files_with_tag.push(file);
    }
});
console.log(files_with_tag);
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda