Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

[[Feature Request]] Open with codeblock view (syntax highlighting, line number, etc) #10

Open
rapatel0 opened this issue Aug 18, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed WIP Currently working on this.

Comments

@rapatel0
Copy link

rapatel0 commented Aug 18, 2022

My primary use case for this at the moment is looking at source files. In particular, scripts that are used in obsidian (see obsidian-customjs plugin) would be really nice to be able to view these with syntax highlighting and other code relate views

@dbarenholz
Copy link
Owner

My primary use case for this at the moment is looking at source files. In particular, scripts that are used in obsidian (see obsidian-customjs plugin) would be really nice to be able to view these with syntax highlighting and other code relate views

I'm working on version 1.0.0 now. The editor has been switched from CM5 to CM6, which has allowed me to get syntax highlights working for various languages (already implemented). I'm closing this issue when I push the new codebase!

@holroy
Copy link

holroy commented Nov 17, 2022

I was just coming to this issue list to add a feature request to allow for codeblock viewing of the source files. In my head it would be just perfect if I could use the editing mode to actually change my various code snippets, mainly in javascript, css (and possibly python eventually), and then see them in all their glory (with syntax highlighting) in preview mode.

So please keep on working on this feature, it'll be used!

@rafaeldtinoco
Copy link

Looking forward to this! Thanks for your work.

@dbarenholz dbarenholz added the help wanted Extra attention is needed label Jun 6, 2023
@dbarenholz
Copy link
Owner

Update: it is easy to statically add syntax highlighting to a file, but I cannot figure out how to do it in a dynamic way that avoids having to write a switch statement with a million cases for the million programming languages that exist.

The current code has a non-functional idea of dispatching the language using CM6 Compartments, but honestly I have no clue what I'm doing so guidance is appreciated :)

@holroy
Copy link

holroy commented Aug 30, 2023

I'm not sure whether the list of available languages are known from your plugin or not, but if they are would it be an option just to check the extension against that list, and if there is a match, then use that language?

Alternatively if the file extension is not the same as the language name, then have a simple conversion list with the plugin settings to correlate the file extension to the language. This way, the end user can customise to their needs, and the main code of the plugin has a simple task of using the file extension to first check in the custom list for a language to use, or use directly as the language if found in the main list of languages available for syntax highlighting.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed WIP Currently working on this.
Projects
None yet
Development

No branches or pull requests

4 participants