Git Product home page Git Product logo

quranlookup's Introduction

بِسْمِ ٱللّٰهِ ٱلرَّحْمٰنِ ٱلرَّحِيْم

Obsidian Quran Lookup Plugin

CodeQL

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.

How to Use:

  1. Open a Note in Obsidian.md
  2. In the note, type the surah:verse as shown in the examples below
  3. Select the recently typed text
  4. In the command panel (cmd+P or ctrl+P) select 'Retrieve Ayat' command
  5. Alternatively, you can assign a hotkey to the command (like cmd+shift+k)

Examples

  • Single Ayah lookup
    • 112:1

obsidian quran lookup single

  • Multiple Ayaat range
    • 56:24-26

obsidian quran lookup range

  • 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

obsidian quran lookup range

Settings

This plugin has some small customizations: in Community Plugins > Installed Plugins > QuranLookup (Options)

obsidian quran lookup settings

Translation Types

  • 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

Remove Parenthesis Contents

${🛑\ {\color{red}Experimental}}\ 🛑$

  • 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:

obsidian quran remove paren

  • 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!

Attributions

The Quran API and Source(s)

The Quran verses are retrieved from

Fuzzy Search

The Fuzzy search feature is made possible using

  • Fuze.js : A powerful lightweight fuzzy-search library, with zero dependencies (github)

How to use

  • 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

How it works

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!

Manually installing the plugin

  • Copy over main.js, styles.css, manifest.json to your vault VaultFolder/.obsidian/plugins/quranlookup/.
  • Reload Obsidian to load the new version of your plugin.
  • Enable plugin in settings window.

How to Contribute

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.

Similar Projects

quranlookup's People

Contributors

abuibrahim2 avatar issam-seghir avatar fauzaanu avatar

Stargazers

Hamza Ben Yazid avatar Mohamed Walid avatar Yaqub avatar  avatar Ashraf Haress avatar Sal avatar Abdulla Hill Baky avatar headsink sink avatar  avatar Ahmed Ashraf avatar  avatar Bagus Tris Atmaja avatar Nazar Hussain avatar  avatar Chaker Atallah avatar Anas MS avatar a13ph avatar Salem Mohsen avatar Omar Elmenawi avatar Haitam avatar  avatar CEM KAAN KÖSALI avatar  avatar Brian Anderson avatar Sameer avatar  avatar Sajjad Salaria avatar  avatar Ahmed Osama avatar Aadam avatar  avatar  avatar Yusuf Bouzekri avatar Hossein Maleknejad avatar Faiz Khuzaimah avatar  avatar

Watchers

 avatar

quranlookup's Issues

Suggested enhancement: Syntax to retrieve all ayahs from a surah

Alsalam alaikum. Jazakallah khair, this plug-in works very well.

Perhaps consider implementing a syntax like Ikhlas:* and 112:* (or Ikhlas:ALL and 112:ALL) to make it easier to retrieve a whole surah.

I notice Ikhlas or 112 by itself is treated as Ikhlas:1 or 112:1, so this would avoid breaking that functionality in case someone relies on it.

Add "Offline Mode" option

Add "Offline Mode" option which downloads and retrieves verses and translations from the locally saved vault rather than calling API

add phonetic text option

Amazing project! I always like to have three lines of text in order to facilitate learning:

  1. Arabic
  2. Phonetic
  3. Translation

Not an issue but how do I donate?

@abuibrahim2 Hello sir, I was trying to find a way to contact you but this is the only way. Just wanted to donate to show my appreciation because I’ve been looking for this feature for a long time

BUG: Unintended appearence of [!TIP]

Thank you for the great plugin @abuibrahim2 . I have the following issue using the latest Obsidian. The Al-quran text still apears but it has preceding > [!TIP]+ text. See image below.

image

I think that is unintended behavior and due to recent updates of Obsidian.

Add alternate layout views like table view for arabic and translation

Add Table view like so:

# Arabic English
30:2 غُلِبَتِ الرُّومُ The Romans have been defeated.
30:3 فِي أَدْنَى الْأَرْضِ وَهُمْ مِنْ بَعْدِ غَلَبِهِمْ سَيَغْلِبُونَ In the nearer land, and they, after their defeat, will be victorious.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.