MatchSyntax

by Eda
5
4
3
2
1
Score: 45/100

Description

The MatchSyntax plugin enables advanced text searches within your notes using a flexible, regex-like query system based on the compromise natural language processing library. It highlights matching parts of the currently active note using a wide range of match types including part-of-speech tags, wildcard patterns, fuzzy matches, and regular expressions. With support for grammatical tags like #Noun, #Verb, #Adjective, and contextual filters like punctuation or casing, it allows precise and nuanced lookups tailored for English content. Ideal for linguists, researchers, and power users who want to dissect or annotate text more intelligently, MatchSyntax offers a unique grammar-aware search capability inside your vault.

Reviews

No reviews yet.

Stats

3
stars
305
downloads
0
forks
360
days
301
days
301
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
3
total issues
1
open issues
2
closed issues
0
commits

Latest Version

10 months ago

Changelog

Full Changelog: https://github.com/rivea0/obsidian-match-syntax/compare/1.1.1...1.2.0

README file from

Github

MatchSyntax for Obsidian

A flexible, "regex-like" lookups for your notes, using the compromise match syntax.

MatchSyntax will highlight the parts of the text in your active note that match your "match-syntax" query.

Examples

Part-of-speech tags can be used for searches of grammatical parts in a note. The syntax for looking for all the adjectives followed by plural words can look like this:

https://github.com/user-attachments/assets/ff264c14-853b-473a-8b8d-c3d76994bd9a

You can do regex searches with // syntax. Let's say we want to look for any word that starts with natur and is followed by either e or al:

https://github.com/user-attachments/assets/f10bc077-7240-44c4-8aa0-0d332e20dcb6

It's always advised to be careful with regex. This will also be slower than other types of lookups.

MatchSyntax is flexible, so you can combine different types of matches. Let's say we first searched for all nouns that are followed after the word "spiritual." Then, we might realize we don't want the plural nouns. So instead, we can use an AND syntax (&&) and negative matching (!) to indicate we want to exclude plural nouns:

https://github.com/user-attachments/assets/89b3b70b-a7f9-47c8-b542-c88d7200d301

[!NOTE] MatchSyntax heavily depends on the compromise library. The matching works only with English grammar; although compromise has some "work-in-progress" for other languages, there is only English support for this plugin at the moment.

Types of matches

MatchSyntax supports most types of compromise matches that are listed below, you can also check out its documentation.

Word-matches

Direct lookups.

Tag-matches (#)

Lookups using part-of-speech tagging.

Supported tags:
#Noun
    #Singular
        #Person
            #FirstName
                #MaleName
                #FemaleName
            #LastName
    #Place
        #Country
        #City
        #Region
        #Address
    #Organization
        #SportsTeam
        #Company
        #School
    #ProperNoun
    #Honorific
    #Plural
    #Uncountable
    #Pronoun
    #Actor
    #Activity
    #Unit
    #Demonym
    #Possessive
#Verb
    #PresentTense
        #Infinitive
        #Gerund
    #PastTense
    #PerfectTense
    #FuturePerfect
    #Pluperfect
    #Copula
    #Modal
    #Participle
    #Particle
    #PhrasalVerb
#Value
    #Ordinal
    #Cardinal
        #RomanNumeral
    #Multiple
    #Fraction
    #TextValue
    #NumericValue
    #Percent
    #Money
#Date
    #Month
    #WeekDay
    #RelativeDay
    #Year
    #Duration
    #Time
    #Holiday
#Adjective
    #Comparable
    #Comparative
    #Superlative
#Contraction
#Adverb
#Currency
#Determiner
#Conjunction
#Preposition
#QuestionWord
#Pronoun
#Expression
#Abbreviation
#Url
#HashTag
#PhoneNumber
#AtMention
#Emoji
#Emoticon
#Email
#Auxiliary
#Negative
#Acronym

See more in the compromise documentation.

Wildcard-matches (./*)

The . character means any one term.

The * character means zero or more terms.

Greedy-match (+)

The+ character at the end of a tag (or .) implies the match will continue with repeated consecutive matches, as far as it can.

Optional matching (?)

The ? character at the end of a word means it is nice to have, but not necessary.

Options list (OR logic)

(word1|word2) parentheses allow listing possible matches for the word (OR logic).

RegEx-match (/<reg>/)

JavaScript regular-expressions using the /myregex/ syntax.

Note: RegEx matches should be carefully used as they can be slower than other types of lookups.

First/Last (^/$)

Something should be in the start, or end of a match.

Negative (!)

Something not-match with a leading ! character.

Range ({min,max})

A maximum, minimum number of wildcard terms.

Prefix, suffix, infix

Sub-word matches, with the regex / / characters.

AND logic (&&)

AND logic using two match statements.

@ methods

  • @hasQuote
  • @hasComma
  • @hasPeriod
  • @hasExclamation
  • @hasQuestionMark
  • @hasEllipses
  • @hasSemicolon
  • @hasColon
  • @hasSlash
  • @hasHyphen
  • @hasDash
  • @hasContraction
  • @isAcronym
  • @isKnown
  • @isUpperCase
  • @isTitleCase

Fuzzy-matches (~)

Text-matching using ~ characters. Damerau–Levenshtein distance is used to compute approximate string matches.

See more in the compromise documentation.

Installation

In Obsidian, you can go to SettingsCommunity pluginsBrowse. Then, search for "MatchSyntax" and click Install.

Or, alternatively, you can clone this repository, and move it to your vault's .obsidian/plugins directory. From there, run:

npm run build

Then, go to SettingsCommunity plugins, and activate MatchSyntax under Installed Plugins.

Usage

MatchSyntax provides two commands: "Enter match syntax" and "Clear match highlights." You can choose "Enter match syntax" to write your syntax and click "Find matches" to see the matched parts of the active note.

You can bind hotkeys for the commands by going to Community plugins, find MatchSyntax in Installed Plugins, and choosing "Hotkeys" button.

Highlights are cleared automatically when there is a change in editor. You can override this behavior by setting "Manually clear the highlights" on inside plugin settings.

TODO and Ideas

  • Custom tags
  • Add setting to display the number of matches in the status bar
  • Add a widget to the editor for input and clearing highlights

License

GPLv3

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Kindle Highlights
3 years ago by Hady Osman
Sync your Kindle notes and highlights directly into your Obsidian vault
PDF Highlights
5 years ago by Alexis Rondeau
Extract highlights, underlines and annotations from your PDFs into Obsidian
HiNote
a year ago by Kai
Add comments to highlighted notes, use AI for thinking, and flashcards for memory.
Raindrop Highlights
4 years ago by kaiiiz
An Obsidian.md plugin that syncs highlights from Raindrop.
Dynamic Highlights
4 years ago by nothingislost
An experimental Obsidian plugin that highlights all occurrences of the word under the cursor
Sidebar Highlights
10 months ago by trevware
Extract Highlights
5 years ago by Alexis Rondeau
Manage your highlights in Obsidian by easily creating, removing and exporting them.
Advanced Codeblock
4 years ago by Lijyze
An obsidian plugin that give additional features to code blocks.
WuCai highlights Official
3 years ago by 希果壳五彩
WuCai highlights Official, for Sync highlights into your obsidian notes
Cloze
3 years ago by Vikki
A plugin for Obsidian which enables converting highlights, underlines, bolded texts, or any selected texts into clozes.
Enhanced Annotations
2 years ago by ycnmhd
Hypothes.is
5 years ago by weichenw
An Obsidian.md plugin that syncs highlights from Hypothesis.
Kobo Highlights Importer
4 years ago by Flavio Cordari
Apple Books - Import Highlights
2 years ago by bandantonio
Import highlights and notes from your Apple Books to Obsidian
Readwise Community
5 years ago by renehernandez
Sync Readwise highlights into your obsidian vault
Focus and Highlight
4 years ago by BO YI TSAI
A plugin for obsidian to focus and highlight on a specific heading in Reading mode.
aDHL
a year ago by tine-schreibt
The Dynamic Highlights Plugin, but with hotkeys, more options and sorting; works well with Highlightr.
Vim Yank Highlight
2 years ago by Aleksey Rowan
Highlight yanked text in Vim mode. Enjoy that subtle animation you've missed so much.
MagicCalendar
3 years ago by Vaccarini Lorenzo
An obsidian plugin that exploit a natural language processing engine to find potential events and sync them with iCalendar
Highlight Public Notes
5 years ago by dennis seidel
TreeFocus
3 years ago by iOSonntag
Obsidian plugin: Highlight, dim & style your files & folders in the file explorer (navigation) based on predefined or custom rules.
Onyx Boox Annotation & Highlight Extractor
4 years ago by Akos Balasko
This tool extracts the highlights and the annotations from OnyxBoox Reading Notes txt files, and converts them to linked zettelkasten literature and permanent notes
Apple Books Highlights
3 years ago by Atif Afzal
Sync your Apple Books highlights in Obsidian
Simple Mention
4 years ago by der-tobi
Obsidian plugin for mentioning people
Vocabulary Highlighter
2 years ago by eatgrass
Highlight English words according to the frequency with Obsidian
Floating Highlights
3 years ago by Karthik S Raju
This is a plugin for obsidian which highlights a block of text or a word as you scroll down while reading.
Pocketbook Cloud Highlight Importer
3 years ago by Lena Brüder
Imports highlights and notes from books stored in the pocketbook cloud to your obsidian vault
HamsterBase Official
3 years ago by HamsterBase
Readavocado Sync
4 years ago by Cyrus Zhang
Readavocado obsidian plugin to sync your favorite highlights.
Highlight Helper
2 years ago by Chongmyung Park
Helper to collect highlight in Obsidian
KoReader Highlight Importer
a year ago by Tahsin Kocaman
Imports highlights and metadata from KoReader into Obsidian notes
Unearthed (Kindle Sync)
a year ago by CheersCal
Kindle Highlights Import
10 months ago by Leon Luttenberger
Plugin for Obsidian that allows users to import Kindle highlights into their Obsidian vault.
TODO Highlighter
a year ago by Nuraly Dyussenov
Obsidian Plugin that formats the exact string TODO, so it can be easily seen in your notes.
Multiplatform Highlights Importer
2 years ago by wwwkieran
Import and consolidate highlights from different reading sources. Supports reconciling books across reading sources.
InfoFlow
a year ago by RockieStar Inc.
Obsidian plugin for InfoFlow.app - This plugin integrates InfoFlow with Obsidian, allowing you to sync your saved articles, web pages, notes, and highlights directly into your Obsidian vault.