mProjectsCode / mProjectsCode/obsidian-shiki-plugin

Add support for language={lang} to highlight code that is used by other plugins. (Tasks, dataview, etc.)

Open
#69 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
238
Forks
25
PR merge metrics
No merged PRs in 30d

Description

I often find myself wanting syntax highlighting when writing code blocks for other plugins in code blocks.
However, the plugins usually need their own key after the backticks to recognize the query.
For example in the Obsidian-tasks plugin, I have queries like this:

```tasks title="Not highlighted code"
not done
filter by function !task.file.folder.includes("Templates/")
filter by function task.file.tags.find((tag) => tag.includes("project")) && true || false
group by function task.filename
```

I would like to specify that this should be considered as Javascript, or any other language the same way we can specify a title and such instead of only using the first word after the backticks.

```tasks language=js title="Highlighted tasks js code"

To get something like this while editing, and still having the plugin working:

not done
filter by function !task.file.folder.includes("Templates/")
filter by function task.file.tags.find((tag) => tag.includes("project")) && true || false
group by function task.filename

I'm not sure how big of an ask that is, but I'm up to try implementing it, if you are interested.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by locating the plugin entry point responsible for parsing code-block attributes and selecting the highlighting language; trace how existing title options are handled. Done means a language attribute such as language=js enables JavaScript highlighting while preserving the original plugin key and behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.