mayurankv/Obsidian-Code-Styler

Feature Request: Align code title & line highlight syntax to standard tools

Closed this issue · 4 comments

Please change the title property to be title= instead of title: in order to support remark plugins / other tools.
We need to change the regex here

const titleMatch = /(["']?)([^\1]+)\1/.exec(parameterString.slice("title:".length));
.
This way we can support https://github.com/kevinzunigacuellar/remark-code-title and https://docusaurus.io/docs/markdown-features/code-blocks

Also, change the line highlight syntax to {1, 4-5} format.
This is the format in shiki (and slidev uses it too) and also docosarous

See the full standard here
https://docusaurus.io/docs/markdown-features/code-blocks

Summary

Change title:my-title to title=my-title and the line highlight format to {1,4-5}

Basic example

Change title:my-title to title=my-title

function A(){
  return <div/>
}

Motivation

This way we can support https://github.com/kevinzunigacuellar/remark-code-title
We can also support other tools like shiki and twoslash and docosarous

Existing Requests?

Hey I can definitely add these as alternative ways to specify line numbers i.e. ln:1,2,4-7 or {1,2,4-7} and I can also make using : or = work for all the parameters.

I don't think you were asking to remove the ln option or : option but just to clarify I'm not likely to change how the plug-in deals with parameters significantly as I wouldn't want users who've set up a lot of codeblocks to need to go and reconfigure them all.

Thanks for the detailed request and the heads up on how other plugins do this, definitely happy to add these.

One side note is that a few plugins such as the execute code plugin and runJS plugin use {parameters here} type options for code locks but I don't think this will be an issue (the user could always use ln instead)

Yea - I did not mean to delete existing :, only to support the existing syntax

This is completed and will be included in the next release!

Hi sorry, I haven't managed to release the new version yet, been busy with work. I'll try to do this soon! Sorry for the delay.