Giter VIP home page Giter VIP logo

cm-editor-syntax-highlight-obsidian's People

Contributors

actions-user avatar dbarenholz avatar deathau avatar github-actions[bot] avatar lastobelus avatar tarpdalton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cm-editor-syntax-highlight-obsidian's Issues

Turns all code white

I haven't seen any issues posted where it's just straight up not working, but it for me all of the code text is white. I've tried installing from Obsidian and manually with the zip file. Restarted many times, tried on a new note.

Incorrect color sheme when exporting to PDF

If you have this plugin installed and your Obsidian theme is set to Dark then when exporting the PDF, the code blocks will remain themed using Dark theme even though the rest of the PDF defaults to Light theme.

Screenshot 2022-02-02 at 11 44 51

Screenshot 2022-02-02 at 11 44 31

Assembly Highlighting

In trying to get assembly highlighting to work, I added this file to this project, and imported it.

This is essentially a copy of the gas.js mode, which I couldn't figure out how to make work on its own, but the mode is renamed to "x86asm" and hardcoded to use x86 assembly.

Originally, I did try using something like

```gas
mov eax, -1
```

But that didn't work.

This file adds highlighting for register names and some other bits of syntax. It doesn't recognize assembly instructions, unfortunately, although it seems like that might have to be custom added or converted from (say) another format like https://github.com/13xforever/x86-assembly-textmate-bundle

In any case, this file does get me highlighting in the editor even though obsidian doesn't highlight assembly in the preview at all.

Request: be more flexible for language tags in Python

I noticed that the editor doesn't do highlighting unless the full name of the language is used:

Both render correctly in preview mode:

Other languages don't seem to have this problem- Typescript code is highlighted in the editor for both ts and typescript. Python seems to be catching an odd case here.

Dark mode awareness

I have YAML frontmatter in some notes. I don't have any custom CSS, and they look like this in dark mode. It's basically unreadable.

image

Text color is the same in light mode, where it's not a problem.
image

The highlighting should be either aware of your theme (at least of dark and light mode) or use colors that are readable in both dark and light mode.

Doesn't work in light mode

Maybe I miss something in the readme ? (it's just about yonce)
The plugin only work with dark mode :
image
VS
image.

Miss I something ? I will be happy to have color syntaxing with my little light theme !

Wrong link in README

In the readme the link to the latest release links to the whitespace plugin and not the syntax highlighting plugin.

Is there a way to change color schema, or manually adjust colors for specific languages?

Hey there,
Fairly new to Obsidian, and just grabbed this plugin. I was wondering if there is there a way to change the overall highlighting color schema, or manually adjust colors for specific languages? I looked under the plugins menu, but it looks like you can only really enable and disable the plugins, not much for options to change? Is there a config file or similar I can adjust for this?

Thanks,
-MH

Looks weird on mobile

I tried the plugin on Android, and it loaded fine, but it seems to use the light mode colors in dark mode.
This is how it looks on desktop:
image
and this on mobile:
image
this is the suspected light colors on desktop:
image

Additionally I found this while loading inspecting with the Chrome adb debugger:

app.js:1 Uncaught TypeError: cm.getOption is not a function
    at eval (eval at <anonymous> (app.js:1), <anonymous>:30245:99)
    at app.js:1
    at t.iterateLeaves (app.js:1)
    at t.iterateLeaves (app.js:1)
    at t.iterateAllLeaves (app.js:1)
    at t.iterateCodeMirrors (app.js:1)
    at CMSyntaxHighlightPlugin._this.refreshLeaves (eval at <anonymous> (app.js:1), <anonymous>:30245:33)
    at CMSyntaxHighlightPlugin._this.layoutReady (eval at <anonymous> (app.js:1), <anonymous>:30241:19)
    at t.e.tryTrigger (app.js:1)
    at t.e.trigger (app.js:1)

trigger auto refresh

thanks for the plugin. If a note is open in edit mode with code when obsidian starts it does not work (shows all white text) until toggling from edit->preview->edit.

You can trigger an update on the active leaf with something like this:

const view = this.app.workspace.activeLeaf.view as MarkdownView;
const editor = view.sourceMode.cmEditor;
// editor.refresh(); //  DOESNT DO ANYTHING
editor.setOption("mode", "css");
editor.setOption("mode", "markdown");

i.e. by swapping the mode from markdown and then back. Maybe this can be applied in the onload()?

Live preview not working

When I use this in Live Preview mode, the code blocks become blank and nothing shows up. When I turn off live preview and use source code mode, it will work in the separate preview pane. I disabled all other plugins besides this one to make sure nothing is conflicting. I have a video of the bug here:

https://i.imgur.com/XNCnf7D.mp4

EDIT: Meant to post this in a different plugin repo, accidentally posted it here because this plugin is also used with that one.

BUG: jsp render error

when i try to usejsp,this plugin will force me to change jsp into other characters, such as jspjsp if I force it to jsp, the rendering of the entire editor will explode and nothing can be seen.

Frontmatter Syntax Highlight (YAML)

Frontmatter is a YAML code.
Now is shown as a plain text.
This is a markdown / script language and as other languages syntax could be coloured.

It would be fantastic to add syntax hightlight for data inside a frontmatter block

Color keys/values in JSON differently

Hi! Thanks for making this plugin :) I'm using JSON frontmatter at the top of my md files within a codeblock (so I get the syntax highlighting) and was wondering if you could somehow make keys/values within the JSON structure different colors? It seems to make all strings the same color, which is fine for keys OR values, but not preferrable for both:

{
   "name":"Kjell",
   "age":35,
   "hometown":"Seattle"
}

In this example, there are only 3 colors:

  • White for braces, colons, and commas
  • Purple for numbers (35)
  • Yellow for all strings.

The main problem I have with all strings being the same color is that in just the past 24 hours, I've accidentally highlighted and copied strings beyond one entire value for long strings (think several paragraphs of markdown which have been JSON.stringified. Then I've deleted them and my JSON was all messed up because I removed too much text because I didn't see the dividing line between one key/value pair and the next.

If you can't, or it's just too much work, I understand. Just thought I'd ask :)

Expose syntax highlighting through an API for use by other plugins

I use the obsidian-spaced-repetition plugin to make flashcards to study programming topics, but when the flashcard content is displayed by the other plugin it doesn't have any syntax highlighting. It would be great if this plugin had an API which I could call from over in the obsidian-spaced-repetition plugin to do something like syntaxHighlightApi.highlightMarkdown(codeFenceTextToHighlight) which would return some HTML with inline styles, perhaps. Just spitballing here.

Raw note content with the syntax highlighting working:
image

What it looks like when rendered by the obsidian-spaced-repetition plugin as a flashcard:
image

Strange behavior when code fence is beneath a multi-level list

When a code fence is under a multi-level list and the language is specified, I'm seeing behavior where the code fence extends to the end of the document. Any insights?

Also, LOVE this plugin, couldn't do without it.

Good Behavior
image

Indented and language specified
image

Indented, language not specified
image

Need to produce another release AKA Elixir highlighting not working

It looks like there needs to be a new release created.

Although the current version is marked as 0.1.2, the bundle is marked as 0.1.1:

Screen Shot 2021-08-26 at 1 50 21 pm

This means that the source code has been updated to include the elixir mode, but it is missing from the release files.

Here is a screen grab using the release of 0.1.2:

Screen Shot 2021-08-26 at 1 24 02 pm

Screen Shot 2021-08-26 at 1 24 23 pm

And this is the same pages, but with a checked out version of the repo and the release files copied into the plugin directory:

Screen Shot 2021-08-26 at 1 38 47 pm

Highlight language when recognized/supported

Hi,

Really love this plugin.
It would be useful to see whether to language selected is supported.
So, it would be cool if the language identifier could change the color if it is recognized.
Just like Discord does:

Screen.Recording.mov

Does this plug-in support HCL?

Does this plug-in support HCL? HCL syntax highlighting doesn't seem to work.

terraform {
  required_providers {
  *****
  }

Could we make syntax highlighting work for Preview mode, too?

Hello.

Obsidian has some missing languages, but this plugin does not, for example: Forth. Is it possible to override Obsidian's default syntax highlighting in Preview mode with your plugin?

Or if you know how to add Forth to Obsidian's syntax highlighting, that would be much appreciated. I think they use CodeMirror, but CodeMirror supports Forth though.

Overriding / editing existing languages

Is their a known method for editing existing languages?

In short; I modified the code so that bash could recognize ; as a comment and the program itself completely ignores it and only continues to recognize #

I then created a bogus language that isn't real (just to have a new unique language name); added the same rules, and it worked fine.

I then decided to decode the typescript source map (base64) and see that the same language definitions exist there too; and it seems like those are overriding the changes to the decoded tables. The only way to get a successful result is by creating an entirely unique language name.

Thanks

[Feature Request] AutoHotkey Syntax Highlighting

Obsidian already has full syntax highlighting in reading mode for AutoHotkey (AHK), but not in Edit mode (neither live preview nor source mode). So that is why I installed the Editor Syntax Highlight plugin. However it seems that Editor Syntax Highlight plugin does not support Autohotkey because there was no change to any AutoHotkey code fences after installation of the plugin.

AutoHotkey is pretty widely known and well used, so it would be great if you would consider adding syntax-highlighting support for this language.

Thanks!

Missing highlighting for `dataviewjs` blocks

It would be great if this could highlight dataviewjs blocks. A quick and easy fix would be to just highlight them the same as Javascript. I managed to hack a fix together locally which will work, but in the hope that it's a little easier to maintain, I've created a PR against CodeMirror to add an alias to the Javascript mode: https://github.com/codemirror/CodeMirror/pull/6833/files

Hopefully if that merges it'll get included in the next release of this plugin? :)

Using Markdown Heading syntax in code block made a rendering error

If I want to write headings like this:

# After I typed `#`,  Obsidian would trigger to refer a tag. I knew it ok.

## But Obsidian would render all headings even in editor mode

### If you toggled to preview mode, Obsidian would render everything very well

And if there was a YAML in Markdown code block would also render bad in editor mode.

PDF Export, wrong colors ?

Hello,

When exporting Shell code to pdf the highlight color is the same than the background :

Obsidian :
image

PDF :
image

I am on the last version for both the plugin and the app.

Is there anything i can do to change the color either from obsidian side or the plugin ?

Thank you.

Obsidianite Theme

I had the Obsidianite theme on since it is my favourite one and the only way I could see the block of code was in view mode, when I go back to edit the whole note goes blank, yet I can still edit the text. I changed the theme and the plugin works just fine now. Might there be a problem with that theme in particular?

No highlighting in preview mode.

Hello. Checked prism.js and they have PHP syntax highlighting.
But using this plugin, code gets highlighted only in editor mode, in preview mode it is plain

I'm using Editor Syntax Highlight plugin version 0.1.2
Check this image.

image

ColdFusion - CFML

I would like to see ColdFusion Syntax Highlight added

cfml
<cfscript>
  for (i=1;i LTE ArrayLen(array);i=i+1) {
    WriteOutput(array[i]);
  }
</cfscript>

I don't mind trying to do it if someone can point me in the right direction.

Shell and Bash languages with Obsidian v1.0.0?

Hello,

This plugin has worked perfectly for me up until the newly released Obsidian v1.0.0. On Obsidian v1.0.0, the plugin doesn't seem to highlight shell and bash languages in the same way it used to; some text is highlighted, but most is not (it seems that python, javascript, css, and others do still work properly). Is anyone else experiencing the same behavior? Maybe it's just me and the syntax has changed for declaring these languages and I'm making the mistake?

In App Download Description Typeo

While browsing plugin descriptions, in Version: 0.1.3 of this plugin I spotted a small typo:

Show syntax highlighing in code blocks the editor

Should be something like:

Show syntax highlighing in code blocks in the editor

Or even better:

Show syntax highlighting inside codeblocks while using the editor

Hahaha: and of course I misspell typo in thus bug report subject line. Lololol

Show whole code block in editor view?

This is great but I can only see a single line in editor view. When I press 'enter', the previous line disappears. Is there a way I can see the whole code block (previous lines and ones below)?

angle brackets trigger highlighting outside of code block

I like to use angle brackets in my writing from time to time.

image

Unfortunately, I cannot do this anymore, as they are automatically recognised as a code block.

I am unsure how to stop this behaviour.

Desired behaviour: only show highlighting when in code block (triple ticks code here)

Enable fenced language names to be recognised.

Hi,

Is it possible change so that {r} is recognised instead of r? As the first is the way it's written in RMarkdown it would be great to be able to write in a coherent manner to that in obsidian.

Thank you.

Add GraphQL SDL syntax

Hi there thanks for the plugin!

It be awesome if you added graphql syntax highlighting! There is currently a 3rd party module available via NPM codemirror-graphql.

It be a huge plus for me! Thanks

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.