Update inline code. Not the rendered markdown

What I’m trying to do

I am trying to change modify the text entered between the ``. What I saw is only a way to proceed the outputted markdown.

Things I have tried

I have been able to output a custom markdown using registerMarkdownPostProcessor. I am unable to see how to change the code that have been entered.

My use case

A user could add a code missing information like a data that should be Auto completed. For eh. my first day in train. If he wants to use that text again via my plugin I could auto set an id to the both instances and more of the sentence.

Thanks,

Hi @Lylian

Have a look at the read, modify and process methods described in:

The spaced repetition plug-in uses read/modify to update the markdown to include scheduling info:

For example after the user reviews a flashcard, a comment such as the following is added. From:

What is special about the HPC instances::Very high inter-node network capability

To:

What is special about the HPC instances::Very high inter-node network capability
<!--SR:!2024-02-11,4,270-->

Hope this helps.

Cheers
Ronny

Thanks to you for the solution you provided.

After reading, I gave up.

I decided to leave everything to the user. He will have to set an id himself. I found the way of modifying the file while the user is typing as a bad practice way. Maybe I could put it in a whole vault reload, I didn’t neither find it as a good practice, I would do something like replace(/xyz/, "xy ___ z"). This could be open to more issues than expected.

Finally I prefer to keep the files safe and provide a notice to the user to jump to that line and set anything himself.

If I understand correctly then your main use case is to avoid repeating to retype some common text/code phrases. This sounds like a case where the use of a clipboard with multiple entries could come in handy, or some sort of snippet tool.

For the latter it sounds like the Text snippet plugin might do the trick, as it allows you to somewhat easily define new snippets to insert into your text using abbreviations or similar tools.

Thanks for your helpful reply.I didn’t explain exactly what the plugin does.

As you focused on the use case I put here, it’s right to use a text snippet plugin instead of creating a new one.

The difference is the dynamism; maybe I’ll publish my plugin. It transforms shortcodes and displays some existing entries with their ID, which I said should be automatically filled. Then I found the unnecessary to do that myself.