This is a simple utility/text replacement plugin for Obsidian that fills in the quran ayaat (verses) based on a surah:verse(s) shorthand. This uses the 'current editor selection command' capability to replace the selected text with the lookup result.
It looks up based on Surah-Number:Ayah-Number
or Surah-Name:Ayah-Number
syntax. For the Surah-Name lookup it uses Fuse.js to do a "fuzzy search" since it's an english transliteration. It replaces that syntax with an Obsidian call-out showing verse+ayah name, arabic, and english.
- Open a Note in Obsidian.md
- In the note, type the
surah:verse
as shown in the examples below - Select the recently typed text
- In the command panel (cmd+P or ctrl+P) select 'Retrieve Ayat' command
- Alternatively, you can assign a hotkey to the command (like cmd+shift+k)
- Single Ayah lookup
112:1
- Multiple Ayaat range
56:24-26
-
Fuzzy search surah title
Zumar:3-5
Zomar:3
Zumaar:6
-
Chained together in single line (separated by spaces)
Zumar:12 6:10-11 7:3-4 Maryam:12 1:3
This plugin has some small customizations: in Community Plugins > Installed Plugins > QuranLookup (Options)
-
You can choose from a variety of english translation types based on the API language selections:
Option Translator en.ahmedali Ahmed Ali en.ahmedraza Ahmed Raza Khan en.arberry A. J. Arberry en.asad Muhammad Asad en.daryabadi Abdul Majid Daryabadi en.hilali Muhammad Taqi-ud-Din al-Hilali and Muhammad Muhsin Khan en.pickthall Mohammed Marmaduke William Pickthall en.qaribullah Hasan al-Fatih Qaribullah and Ahmad Darwish en.sahih Saheeh International en.sarwar Muhammad Sarwar en.yusufali Abdullah Yusuf Ali en.maududi Abul Ala Maududi en.shakir Mohammad Habib Shakir en.transliteration English Transliteration en.itani Clear Qur'an by Talal Itani
- Some translations provide additional commentary and explanation in parenthesis ( ) and brackets [ ] to give context and allow the translator the opportunity to explain a nuanced, complex term. While this is useful at times, it makes the text very verbose and breaks the flow for the reader. With the toggle enabled, this plugin removes that additional text so that the translation is succinct like the arabic.
- See example below:
- NOTE: This is experimental and while I have tried to test it, it may not work 100% all the time so extra eyes QA'ing it are appreciated!
The Quran verses are retrieved from
- alquran.cloud : An opensource Quran API made by the Islamic Network (github) and respective contributors.
The Fuzzy search feature is made possible using
- Install & enable the plugin (see section below )
- Select the ayah reference string in your note
- Use the command palette or a hotkey to apply the replace command
The lookup uses api.alquran.cloud API to lookup the verses by surah and verse number For the fuzzy name search, it uses a simple index file surahSlim.json and fuse.js to find the closest sura name and retrieve it's index number.
Future Feature Ideas (logged in project Issues)
- Add error notification for 'surah not found' or 'ayah index out of range' (currently doesn't do anything if invalid string is attempted to be upon)
- Show the translator name in the settings
- Toggle Display of verses callout sections: e.g. show Arabic Only, Translation Only
- Right-To-Left alignment for Arabic text
- Support display of alternate arabic fonts
- Add support for translations in other languages
- Allow for customization of the Call-out style in the settings (e.g. abstract, info, note, success, question, warning, failure, danger, bug, example, quote, custom, none)
- Give option to show dialog with preview and style options each time (like the Admonition plugins 'Insert Admonition' dialog)
- Add option to toggle to use 'Admonition' style syntax instead of obsidian call-out style
- Provide external links to ayah in websites like quran.com
- Add "Offline Mode" option which downlaods and retrieves verses and translations from the locally saved vault rather than calling API
- Add command to search for an ayah using search API (displaying results in a dialog)
- Add audio playback capabilities to playback the verse
- Other ideas?... feel free to suggest!
- Copy over
main.js
,styles.css
,manifest.json
to your vaultVaultFolder/.obsidian/plugins/quranlookup/
. - Reload Obsidian to load the new version of your plugin.
- Enable plugin in settings window.
I'm one person who just quickly put this together because I wanted this capability in my notes. This is still in need of much refactoring and improvement.
- Obsidian Quran Vault
- Obsidian Bible Reference - Notable mention, I styled this readme doc after theirs.