Obsidian plugin with options to customize the behavior of CodeMirror

Overview

Obsidian CodeMirror Options

This plugin adds configurable options to customize the behavior of CodeMirror.

Installation

Manual Installation

To manually install

  1. download the latest zipfrom the latest Github Release
  2. unzip the contents into the .plugins/obsidian-codemirror-options subdirectory of your vault.
  3. reload obsidian
  4. go into settings > third party plugins and activate obsidian-codemirror-options

For details see the forums.

Features

Syntax Highlighting

When enabled, this plugin will apply a consistent syntax highlighting theme to code blocks in both edit and preview modes.

By default, the plugin applies the theme "Material: Palenight" to both light and dark modes.

If you'd like to customize the syntax highlighting theme, install Style Settings and explore the CodeMirror Options section within the Style Settings Plugin Options.

This plugin currently includes 4 theme options out of the box:

  • Solarized Light
  • Material Palenight
  • Dracula
  • Custom

When using the custom theme, you can customize any of the available syntax highlighting colors. You can also use the custom theme option to import your own themes using the Style Settings import function.

Here's an example of importing the Dracula theme for use in dark mode only:

{
"CodeMirror Options@@cm-background@@dark": "#282a36",
"CodeMirror Options@@cm-foreground@@dark": "#f8f8f2",
"CodeMirror Options@@cm-comment@@dark": "#6272a4",
"CodeMirror Options@@cm-string@@dark": "#f1fa8c",
"CodeMirror Options@@cm-string-2@@dark": "#f1fa8c",
"CodeMirror Options@@cm-number@@dark": "#bd93f9",
"CodeMirror Options@@cm-variable@@dark": "#50fa7b",
"CodeMirror Options@@cm-variable-2@@dark": "#ffffff",
"CodeMirror Options@@cm-def@@dark": "#50fa7b",
"CodeMirror Options@@cm-operator@@dark": "#ff79c6",
"CodeMirror Options@@cm-keyword@@dark": "#ff79c6",
"CodeMirror Options@@cm-atom@@dark": "#bd93f9",
"CodeMirror Options@@cm-meta@@dark": "#f8f8f2",
"CodeMirror Options@@cm-tag@@dark": "#ff79c6",
"CodeMirror Options@@cm-attribute@@dark": "#50fa7b",
"CodeMirror Options@@cm-qualifier@@dark": "#50fa7b",
"CodeMirror Options@@cm-property@@dark": "#66d9ef",
"CodeMirror Options@@cm-builtin@@dark": "#50fa7b",
"CodeMirror Options@@cm-variable-3@@dark": "#ffb86c",
"CodeMirror Options@@cm-type@@dark": "#ffb86c",
"CodeMirror Options@@cm-activeline-background@@dark": "#414458",
"CodeMirror Options@@cm-matchingbracket@@dark": "#ffffff"
}

Similarly, you can import a theme for use in light mode by using @@light:

{
"CodeMirror Options@@cm-background@@light": "#282a36",
"CodeMirror Options@@cm-foreground@@light": "#f8f8f2",
"CodeMirror Options@@cm-comment@@light": "#6272a4",
"CodeMirror Options@@cm-string@@light": "#f1fa8c",
"CodeMirror Options@@cm-string-2@@light": "#f1fa8c",
"CodeMirror Options@@cm-number@@light": "#bd93f9",
"CodeMirror Options@@cm-variable@@light": "#50fa7b",
"CodeMirror Options@@cm-variable-2@@light": "#ffffff",
"CodeMirror Options@@cm-def@@light": "#50fa7b",
"CodeMirror Options@@cm-operator@@light": "#ff79c6",
"CodeMirror Options@@cm-keyword@@light": "#ff79c6",
"CodeMirror Options@@cm-atom@@light": "#bd93f9",
"CodeMirror Options@@cm-meta@@light": "#f8f8f2",
"CodeMirror Options@@cm-tag@@light": "#ff79c6",
"CodeMirror Options@@cm-attribute@@light": "#50fa7b",
"CodeMirror Options@@cm-qualifier@@light": "#50fa7b",
"CodeMirror Options@@cm-property@@light": "#66d9ef",
"CodeMirror Options@@cm-builtin@@light": "#50fa7b",
"CodeMirror Options@@cm-variable-3@@light": "#ffb86c",
"CodeMirror Options@@cm-type@@light": "#ffb86c",
"CodeMirror Options@@cm-activeline-background@@light": "#414458",
"CodeMirror Options@@cm-matchingbracket@@light": "#ffffff"
}

The CSS properties match closely to the standard properties used by CodeMirror. You can find more theme colors here https://codemirror.net/theme/ and adapt them to this import format.

Settings

Dynamic Cursor Sizing

When enabled, the cursor height will be determined by the max height of the entire line. When disabled, the cursor's height is based on the height of the adjacent reference character.

Retain Active Line on Selection

When enabled, text selection will not remove the .active-line class on the current line. When disabled text selection on the active line will remove the .active-line class.

Mark Selected Text with a CSS class

When enabled, selected text will be marked with the CSS class .CodeMirror-selectedtext. This replaces the default CodeMirror selection functionality which mimics a selection by painting a background layer behind the text. This new option grants more styling flexibility and avoids issues when selecting items that have defined backgrounds.

Use CodeMirror for syntax highlighting in preview mode

This setting creates consistent highlighting between edit and preview by using CodeMirror to highlight in both modes. Note: This setting requires the "Editor Syntax Highlight" plugin to function.

Fallback: Unify the default prism.js code block styling

This setting is a fallback option if you do not want to inject CM into preview mode. It will try and unify the prism.js colors to match the CodeMirror theme as close as possible.

Known Issues

  • This plugin leverages the CM5 API directly which is a deprecated option. Obsidian will be moving to CM6 soon and this plugin will break. I'm not sure yet if I'll be able to make these same tweaks on CM6.

Changelog

0.1.3

  • Move copy button to top right and reduce size
  • Remove trailing line breaks from copied text
  • Add option to include copy button on all PRE blocks in preview

0.1.2

  • More bug fixes to syntax highlighting logic

0.1.1

  • Bug fixes to the line number and copy button handling
  • Add highlighting support for js html and json

0.1.0

  • Add an option to show line numbers in preview mode
  • Add a copy button to code blocks in preview mode
  • Fix the default font size for code blocks to 16px. This can be overridden using Style Settings
  • In preview mode, wrap code blocks in a <code> element to better mimic the original prism.js DOM structure.
    • The structure is now <div><pre><code></code></pre></div>
    • This change should hopefully be transparent for most use csses

0.0.8

  • This is the stable(ish) release of the features introduced in the 0.0.7 pre-release.
  • This release adds two HyperMD features
    • Hide Markdown Syntax
    • Click Handling for Checkboxes
  • Adds syntax highlighting support for plugins like Obisdian Plaintext & CodeView

0.0.7 (pre-release)

  • This release adds two HyperMD features
    1. Hide Markdown Syntax
    2. Click Handling for Checkboxes

0.0.6

  • Changed the method used for marking multiple lines with .active-line which should resolve a few bugs
  • Previously .active-line would start behaving strangely after having 8 lines selected
  • The previous method was also not effecient and applied the .active-lines class too often
  • Previously, the "Style Active Selection" and "Mark Active Lines" settings were too intermingled. You can now set each feature on or off without impacting each other.

0.0.5

  • Fixed a bug in the "Style Active Selection" option which was causing an undefined variable error on file load

0.0.4

  • Updated "Retain Active Line on Selection" to support multi-cursor selection

0.0.3

  • Updated "Retain Active Line on Selection" to support multi-line selection

0.0.2

  • Code cleanup
  • Added Syntax Highlighting options

0.0.1

  • Initial release
    • Enabled toggles for:
      • Dynamic Cursor Sizing
      • Retain Active Line on Selection
      • Mark Selected Text with a CSS class
Comments
  • [Bug] Inline latex renders as block latex

    [Bug] Inline latex renders as block latex

    There are some differences between how latex is rendered in preview mode and how latex is rendered in editor. I guess that is because even in in editor mode you render inline latex as block latex.

    I think so, because according to specification integral in inline mode should be rendered like this: Снимок экрана 2021-11-24 в 15 44 25 and in block mode like this: Снимок экрана 2021-11-24 в 16 00 09 (it is taller comparing to f(x))

    But while using this plugin latex always renders like this: Снимок экрана 2021-11-24 в 15 44 19. It looks more like the second variant (except the braces, but it is just a different symbols, nevermind)

    So, please, could you fix this issue and render different latex depending on math type (inline or block). By the way, your plugin is awesome! I use it only for math, since other cases didn't found convenient FOR ME, and since I'm studying in a university the plugin helps me a lot!

    opened by y9san9 9
  • Dataview's dv.current() renders in preview but not in edit mode

    Dataview's dv.current() renders in preview but not in edit mode

    Hi!

    First, thank you so much for this plugin.. pretty much the best WYSIWIG solution I've seen for Obsidian, and then some!

    I just wanted to point out a small bug in the way the plugin handles specifically the dv.current() call in codeblocks. I posted about it in Discord but thought it might be worth filing an issue here officially.

    Steps to reproduce:

    1. Create a dvjs block with this line by itself:
    dv.paragraph(dv.current())
    
    1. With the dataview option enabled in CodeMirror Options, check how it renders in edit mode. I get an error like:
    Evaluation Error: Error: dv.page only handles string and link paths; was provided type 'undefined'
    
    1. Compare that with preview mode. It renders the file object as expected there.
    opened by frankreporting 8
  • Crash on Auto Align Table

    Crash on Auto Align Table

    I'm getting a crash related to Auto Align Table on v 0.3.1 (Obisidian 0.12.18 w/installer 0.12.4 on Windows) Thought maybe Advanced Tables was conflicting, but I turned that off and still saw the error.

    Error is: "Uncaught TypeError: Cannot read property '0' of undefined"

    Here's what my file looks like:

    ---
    fileClass: Task
    name: Send training invites
    status: Doing ▶
    started: 2021-10-13
    ---
    
    people:: [[PERSON NAME]]
    related:: [[PROJECT NAME]]
    
    # Send training invites
    ## Ideas:
    | Week | Topic                                       | Americas        | Asia                 |
    | ---- | ------------------------------------------- | --------------- | -------------------- |
    | 1    | Basics for grabbing slides                  | 10/26 9-10am ET | 10/26 10-11am Mumbai |
    | 2    | Putting together your DE&I Quarterly report | 11/02 9-10am ET | 11/02 10-11am Mumbai |
    | 3    | Exploring Hiring and Turnover storyboards   | 11/10 9-10am ET | 11/11 10-11am Mumbai |
    | 4    | Who is spending too much time in grade?     | 11/17 9-10am ET | 11/17 10-11am Mumbai |
    | 5    | Build your own storyboard from scratch      | 11/23 9-10am ET | 11/23 10-11am Mumbai |
    
    opened by dpmeltz 8
  • Hide link addresses, only show titles?

    Hide link addresses, only show titles?

    Thank you for this plugin! I'm not sure if it's within the scope of this project, but would it be possible to hide link addresses when they have titles? For instance, in a link like [[2021-09-29|today]], would it possible to hide not only the "[[]]", but also the "2021-09-29" and the "|" and only show "today"?

    opened by loopernow 7
  • Support nested code blocks

    Support nested code blocks

    Hello,

    Thank you for this plugin. It makes obsidian really look great in edit mode and reduces the switching.

    I was wondering whether you could support nested code blocks? For example, I have Tasks search queries embedded in admonitions. The admonition renders well but not the search query.

    ````ad-done
    title: tasks to prioritize today
    collapse: open
    ```tasks
    sort by description
    due on 2021-11-02
    path does not include template
    hide recurrence rule
    hide due date
    hide done date
    ```
    ````
    
    opened by astoicstradingtools 6
  • [Bug] : flickering problem

    [Bug] : flickering problem

    There is a problem with the cursor when rendering admonition with inline buttons.

    https://user-images.githubusercontent.com/38974541/140332142-5d312234-6465-4356-b01b-ccb80d01d935.mov

    opened by imeed166 5
  • Size in markdown image link

    Size in markdown image link

    I can't see the reduced image when I have a markdown link, with wikilink links it works perfectly. Is there anything to activate?

    Example:

    ![100](Pasted%20image%2020210623121236.png)
    
    bug pending validation 
    opened by javiavid 5
  • Code Copy and Code Block Enhancer plugin incompatibility

    Code Copy and Code Block Enhancer plugin incompatibility

    opened by NomarCub 5
  • Pre-release 0.07 WYSIWYG bold, italic, monospace cannot be rendered

    Pre-release 0.07 WYSIWYG bold, italic, monospace cannot be rendered

    Imgur

    Proper rendered (Successfully hide markdown)

    • Headers
    • Quotes
    • Internal Link / Backlink

    Not rendered (Cannot hide markdown)

    • both syntax (**bold** or __bold__)
    • both syntax (*italic* or _italic_)
    • mono space

    I know it's still under development; I have been expecting this feature for a long time, and I truly hope bold, italic, and monospace can be implemented. 👍 😄

    opened by ArmandXiao 5
  • Add support for URL based images?

    Add support for URL based images?

    Hi,

    The new image preview is amazing but unfortunately it doesn't work with URL based images, only local ones. I don't know if this is a fundamental issue or just about the parser, but if it's the latter it would be awesome to have those work too.

    Here's an example:

    ![](https://obsidian.md/images/screenshot.png)

    Thanks!

    opened by cansar 4
  • How to set up to see “ the <CODE> and <HTML> buttons”

    How to set up to see “ the and buttons”

    How to set up to see “ the 'CODE' and 'HTML' buttons” ? I have opened all the settings in CodeMirror Options,And did not see any button display at the bottom ( I use is [Blue topaz] theme ) . Did I set something wrong?

    set

    button

    opened by traymi 3
  • [bug] code syntax highlight in read mode doesn't work!!

    [bug] code syntax highlight in read mode doesn't work!!

    • Obsidian 1.0
    • Codemirror Option 0.9.5

    code syntax highlight in read mode doesn't work!!

    I've just started using the plugin, I guess it may caused by obsidian update

    The plugin need a update now

    opened by domeniczz 0
  • [Plugin Request] Make a separate plugin for Math Preview

    [Plugin Request] Make a separate plugin for Math Preview

    Hallo! Thanks for your great job done. Migrated now to the new obsidian live preview, BUT your plugin is SO USEFUL thing especially talking about MathPreview. There is NO another plugin for that, what the hell?

    Could you please make a separate plugin with only this feature since it's not supported natively by obsidian.

    opened by y9san9 0
  • [new function && bug] Line numbers show conflicts between functions and code running plugins

    [new function && bug] Line numbers show conflicts between functions and code running plugins

    There is now an execute code plugin that can run python code in obsidian and see the results. However, the line number display function of this plugin will conflict with the execute code. image

    There is another code block enhancer's line number display function that supports the execution of python code, but that plugin has other bugs related to execute code.

    image

    I hope the author can modify the display of line numbers by referring to the code block enhancer, so that simple python code can be run in obsidian, which can save the trouble of opening the editor and building projects in many cases. Because interactive python is inconvenient to run some slightly longer python programs

    opened by Saunak626 1
  • Support timeline plugin

    Support timeline plugin

    Hello, can you please support the real-time rendering of the timeline plugin?

    This is a very useful plugin. If there is a great timeline

    I look forward to it. https://github.com/George-debug/obsidian-timeline

    image

    opened by MugenLee 0
  • obsidian-codemirror-options breaks build v0.13.14

    obsidian-codemirror-options breaks build v0.13.14

    Hey there- I realize you documented that Live Preview in Obsidian overlaps/collides with functionality here, but FYI this plugin breaks Obsidian v0.13.14 by blocking vault load with

    Error:  Element 'cs' not found
    

    So the Obsidian object model or something has changed such that it blocks loading of the vault until I edited community-plugins.json and removed the entry for obsidian-codemirror-options.

    This is on MacOS Catalina.

    FYI/Thanks- Michael

    opened by MichaelSEA 1
Releases(0.9.5)
  • 0.9.4(Nov 26, 2021)

  • 0.9.3(Nov 24, 2021)

  • 0.9.1(Nov 19, 2021)

  • 0.9.0(Nov 19, 2021)

  • 0.8.4(Nov 10, 2021)

  • 0.8.3(Nov 8, 2021)

    0.8.1-0.8.3

    • Inline Block Embed related styling fixes
      • List item block references should now behave properly when embedded
      • Tweaks to ensure the <EMBED> icon is always clickable
      • Updated the mouse over label on inline block refs to show the filename of the ref
      • Fixed the inline block ref click handler to cover the entire length of the block ref
    • Rendered widgets now render properly when expanding lists or headers
    • Fixed the display of embedded PDFs
    • Fixed occasional line widget duplication with embeds and html
    Source code(tar.gz)
    Source code(zip)
    main.js(293.11 KB)
    manifest-beta.json(311 bytes)
    manifest.json(311 bytes)
    styles.css(54.63 KB)
  • 0.8.2(Nov 5, 2021)

    Shiny new things

    • Added the ability to render embeds in edit mode.
      • Page, header, and block refs are all supported
      • Embeds can be referenced inline or as a dedicated line block
      • Embeds are rendered using the same renderer that generates preview mode embeds.
        • This means all plugins are supported out of the box and will render properly when embedded.

    Known Issues

    • The Outliner plugin list styling can cause the <EMBED> button to get truncated due to setting overflow: none on the list list
    • In rare cases, embed widgets may render twice
    • Editing a ref to point to a new page can something cause the old ref content to not be cleared out
    Source code(tar.gz)
    Source code(zip)
    main.js(291.20 KB)
    manifest-beta.json(311 bytes)
    manifest.json(311 bytes)
    obsidian-codemirror-options.zip(72.85 KB)
    styles.css(53.00 KB)
  • 0.7.0(Nov 3, 2021)

    Shiny new things

    • Show backlinks in the edit mode footer
    • Render Tasks (from the Tasks plugin) in edit mode

    Improvements

    • Rendered code blocks in edit mode now have proper lifecycle management
      • This means that rendered code blocks will now update in real time without the need to click into the block and rerender
    • Admonitions in edit mode will now properly render nested code blocks
      • This means you can render things like Tasks or Charts inside an Admonition
    Source code(tar.gz)
    Source code(zip)
    main.js(279.14 KB)
    manifest-beta.json(311 bytes)
    manifest.json(311 bytes)
    obsidian-codemirror-options.zip(70.27 KB)
    styles.css(48.31 KB)
  • 0.6.0(Oct 29, 2021)

    Shiny new things

    • Render Banners in edit mode

      • This option will render banners in edit mode in the same way that the Banners plugin renders them in preview mode
      • Two new front matter attributes have been added but will currently only be respected in edit mode
        • banner-height: [measurement]
        • banner-style: [gradient|solid]
    • Use Front Matter variables as CSS selectors or as CSS variables

      • The Container Attributes feature will now parse front matter variables and add them to div.view-content as CSS variables as well as data attributes.
      • This allows you to use front matter variables as selectors or as values.
      • Since the variables and attributes are applied on div.view-content, you can use them to style both edit and preview modes
      • Variables must be registered within the plugin settings page before they can be used in CSS
        • This is to prevent polluting the DOM with everything inside of front matter
      • Front Matter variables with values that look like file paths will be converted to the full app://... path so that the files can be referenced within CSS
        • This is useful for setting a local vault image as the background-image for a certain element on the page

    Improvements

    • Allowed for longer rendering times on rendered Dataview & Embedded Search widgets
      • This should help avoid any rendering issues on initial application load
    • General improvements to the UX of rendered code blocks and HTML
      • Rendered block elements should no longer break open when the cursor is placed next to them or when a selection touches them
      • Restyled and repositioned the <CODE> and <HTML> buttons
    • The math preview will now properly close when the active expression is deleted
    Source code(tar.gz)
    Source code(zip)
    main.js(373.60 KB)
    manifest-beta.json(311 bytes)
    manifest.json(311 bytes)
    styles.css(48.17 KB)
  • 0.5.3(Oct 28, 2021)

  • 0.5.2(Oct 28, 2021)

    • Additional fixes to Math formatting and layout
    • Updated the <HTML> and <CODE> button behavior to be less obtrusive
    • Fixed a bug that caused rendered HTML elements to be duplicated in some circumstances
    • The math preview will now properly close when the active expression is deleted
    • Added support for image sizing in markdown images [100]()
    • Allowed rendering of images over the plain HTTP:// protocol
    • HTML and Code blocks will no longer collapse when moving the cursor into or near them
      • The only way to break a HTML or Code block is to click the <HTML> or <CODE> button
    Source code(tar.gz)
    Source code(zip)
    main.js(262.94 KB)
    manifest-beta.json(311 bytes)
    manifest.json(311 bytes)
    obsidian-codemirror-options.zip(67.21 KB)
    styles.css(47.33 KB)
  • 0.5.1(Oct 25, 2021)

    • Added an option to not style rendered edit mode checkboxes

    • Added a new data attribute to edit mode checkboxes data-task which will contain the character inside of the task [ ] brackets

      • <span class="cm-formatting cm-formatting-task cm-property hmd-hidden-token" data-task="?">[?]</span>
    • Fixed a bug that was preventing Mathjax from being rendered as a block

    • Fixed a bug that was causing math to not be styled correctly

    Source code(tar.gz)
    Source code(zip)
    main.js(261.81 KB)
    manifest-beta.json(311 bytes)
    manifest.json(311 bytes)
    obsidian-codemirror-options.zip(66.82 KB)
    styles.css(46.88 KB)
  • 0.5.0(Oct 24, 2021)

    Shiny new things

    • Inline Mathjax Rendering
      • Mathjax inside of $ $ or $$ $$ will now render directly in edit mode. Click into the rendered element to edit it
      • Rendering is done by the built-in Obsidian Mathjax renderer and has all of the same features and settings
    • Mathjax Preview
      • When editing a Mathjax element, a draggable preview modal will appear showing you what the rendered Mathjax will look like

    Bug fixes

    • Fixed an issue that was preventing the current file path from being passed to edit-mode rendered Dataview blocks
      • This was preventing calls like dv.current() from working
    Source code(tar.gz)
    Source code(zip)
    main.js(260.62 KB)
    manifest-beta.json(311 bytes)
    manifest.json(311 bytes)
    obsidian-codemirror-options.zip(66.60 KB)
    styles.css(46.80 KB)
  • 0.4.2(Oct 22, 2021)

    Shiny new things

    • HTML Rendering
      • HTML tags will be passed through DOMPurify and then rendered inline. You can click into the rendered element to see and edit the HTML source.
      • HTML tags at the beginning of a line will be treated as a full line block
      • HTML tags placed inline will be treated as inline-blocks
    • Code Rendering
      • Charts
        • Renders chart blocks in edit mode using the Obisidian Charts plugin
      • Admonitions
        • Renders Admonition blocks in edit mode using the Admonitions plugin
      • Dataview
        • Renders Dataview blocks in edit mode using the Dataview plugin
        • Limitations
          • Rendered Dataview content is only calculated at initial render time. They will not continue to update on an interval like they do in preview mode. If you want to refresh a view, you can click into the query and back out to force a refresh.
      • Embedded Search Queries
        • Limitations
          • Embedded query results are only calculated at initial render time. They will not continue to update over time like they do in preview mode. If you want to refresh a query, you can click into the query and back out to force a refresh.

    Improvements

    • Added "Copy Image to Clipboard" to the editor context menu, when clicking on inline rendered images. This only triggers if the IMG has the class "hmd-image", which is set on all inline rendered images by default.
      • The "Copy Image to Clipboard" option will also show on any images displayed inside of a rendered code block
      • "Copy Image to Clipboard" supports internal and external images
    • Added .cm-collapse-external-links body class for Collapse External Links feature
    • Fixed overly aggressive inline latex regex in OpenMD Mode

    Known Issues

    • Multiple aspects of this plugin will break if the Templater plugin's "Syntax Highlighting " feature is turned on. It is recommended to disable Templater's "Syntax Highlighting" and enable "OpenMD Mode" within CodeMirror Options which enables support for Templater syntax.
    • Some themes alter the z-index in a way that causes the <CODE> button widget to not display on top of the rendered element. The theme designers will need to address this but in the mean time, you can force the code to display by creating a selection into the element.
    Source code(tar.gz)
    Source code(zip)
    main.js(241.60 KB)
    manifest-beta.json(311 bytes)
    manifest.json(311 bytes)
    obsidian-codemirror-options.zip(62.40 KB)
    styles.css(45.26 KB)
  • 0.3.1(Oct 13, 2021)

    0.3.1

    • Further improved the performance of Collapse External Links and Render Images Inline
    • Fixed a bug which was preventing images from rendering when initially inserted into the document

    0.3.0

    Shiny new things

    • OpenMD
      • Added Single Column Table Support
      • Added native Templater Syntax Support
      • Added support for Headers in Lists
    • Added the Auto Align Tables feature
    • Added the Render Images Inline feature

    Improvements

    • Removing "task" from the Token List option will now properly remove the CSS styled check box
    • The Token List setting to allows text selection
      • This is to allow copy/pasting the default token list
    • Fixed a performance related issue with Collapse External Links & Render Images Inline
      • These settings were doing way more work than needed which caused noticeable lag when working on large documents. In addition, turning the settings off did not properly unload the CodeMirror event handlers.
      • These settings may be unstable as the performance tweaks are ironed out. If you notice lag, disable both of these options and see if things improve.

    Known Issues

    • Selecting inline images can cause an image to not render after the selection is cleared. Making a change anywhere in the editor will fix this for now.
    Source code(tar.gz)
    Source code(zip)
    main.js(184.19 KB)
    manifest.json(311 bytes)
    obsidian-codemirror-options.zip(48.59 KB)
    styles.css(42.22 KB)
  • 0.3.0(Oct 13, 2021)

    0.3.0

    CodeMirror Options 0.3.0 Demo

    Shiny new things

    • OpenMD
      • Added [Single Column Table Support
      • Added native Templater Syntax Support
      • Added support for Headers in Lists
    • Added the Auto Align Tables feature
    • Added the Render Images Inline feature

    Improvements

    • Removing "task" from the Token List option will now properly remove the CSS styled check box
    • The [[Token List]] setting to allows text selection
      • This is to allow copy/pasting the default token list
    • Fixed a performance related issue with [[Collapse External Links]] & [[Render Images Inline]]
      • These settings were doing way more work than needed which caused noticeable lag when working on large documents. In addition, turning the settings off did not properly unload the CodeMirror event handlers.
      • These settings may be unstable as the performance tweaks are ironed out. If you notice lag, disable both of these options and see if things improve.

    Known Issues

    • Selecting inline images can cause an image to not render after the selection is cleared. Making a change anywhere in the editor should fix this for now.
    Source code(tar.gz)
    Source code(zip)
    main.js(183.61 KB)
    manifest.json(313 bytes)
    obsidian-codemirror-options.zip(48.45 KB)
    styles.css(42.22 KB)
  • 0.2.1(Oct 5, 2021)

    0.2.1

    • Bug fixes related to the 0.2.0 release
    • Register commands for most options
    • Fix highlighting token parsing
    • Fix code block class application

    0.2.0

    • This is a major release which adds/changes quite a few things
    • Updated: Hide Markdown Tokens
      • Further stabilization improvements
        • Removed all usage of display: none in edit mode due to the fact that this hiding method breaks cursor placement
        • All token hiding should be done with font-family: monospace;font-size: 1px !important; letter-spacing: -1ch;color: transparent;
        • If you have a theme or CSS snippet that is using display:none on elements inside of a CodeMirror block, it is advised to disable those styles in favor of the token hiding provided by this plugin.
      • Added the ability to enable/disable each token type individually
      • Added hiding support for additional token types
        • Highlight/Mark
        • Internal link URL & Ref
    • New: Container Attributes
      • This new option applies data attributes to all CodeMirror line divs that describe the child elements contained within the line
      • Think of this like Contextual Typography for Edit Mode
      • This option currently applies the following attributes to each CodeMirror line
        • [data-tag-name="<html_element_type>"]
          • Currently supported HTML tags: ol, ul, h1-h6, code, frontmatter
        • [data-heading="<the_full_text_of_any_heading_found>"]
        • [data-hashtags="<space_delimited_list_of_all_tags_found>"]
    • New: OpenMD Mode
      • This new option replaces Obsidian's HyperMD mode with a modified version which enables new functionality
      • The new mode is forked from official HyperMD mode and tries to replicate any Obsidian specific customizations
      • Warning: This new mode could have missing features or differences in parsing behavior when compared to the default Obsidian mode. Please raise an issue for any regressions or bugs encountered.
      • New functionality provided by this mode:
        • Enhanced parsing of internal links to split up file name, reference, and alias into distinct spans. This allows for proper hiding of internal link tokens when using the "Hide Markdown Tokens" feature
        • Fixed the handling of hashtags that include underscores
    • New: Collapse External Links
      • This features collapses external links (in edit mode) so that they only show the link name. The full link text will expand when clicking into the link.
    • Updated: Edit Mode Click Handler
      • This option has been updated to add a class to the div.cm-s-obsidian element whenever a modifier key is pressed
        • Currently supports ctrl (.HyperMD-with-ctrl), alt (.HyperMD-with-alt), meta (.HyperMD-with-meta)
        • This feature allows you to apply conditional CSS like changing the cursor to a pointer when hovering a link and also pressing ctrl/cmd
    • New: Set cursor blink rate
    Source code(tar.gz)
    Source code(zip)
    main.js(161.06 KB)
    manifest.json(311 bytes)
    obsidian-codemirror-options.zip(43.48 KB)
    styles.css(36.97 KB)
  • 0.2.0(Oct 4, 2021)

    0.2.0

    • This is a major release which adds/changes quite a few things
    • Updated: Hide Markdown Tokens
      • Further stabilization improvements
        • Removed all usage of display: none in edit mode due to the fact that this hiding method breaks cursor placement
        • All token hiding should be done with font-family: monospace;font-size: 1px !important; letter-spacing: -1ch;color: transparent;
        • If you have a theme or CSS snippet that is using display:none on elements inside of a CodeMirror block, it is advised to disable those styles in favor of the token hiding provided by this plugin.
      • Added the ability to enable/disable each token type individually
      • Added hiding support for additional token types
        • Highlight/Mark
        • Internal link URL & Ref
    • New: Container Attributes
      • This new option applies data attributes to all CodeMirror line divs that describe the child elements contained within the line
      • Think of this like Contextual Typography for Edit Mode
      • This option currently applies the following attributes to each CodeMirror line
        • [data-tag-name="<html_element_type>"]
          • Currently supported HTML tags: ol, ul, h1-h6, code, frontmatter
        • [data-heading="<the_full_text_of_any_heading_found>"]
        • [data-hashtags="<space_delimited_list_of_all_tags_found>"]
    • New: OpenMD Mode
      • This new option replaces Obsidian's HyperMD mode with a modified version which enables new functionality
      • The new mode is forked from official HyperMD mode and tries to replicate any Obsidian specific customizations
      • Warning: This new mode could have missing features or differences in parsing behavior when compared to the default Obsidian mode. Please raise an issue for any regressions or bugs encountered.
      • New functionality provided by this mode:
        • Enhanced parsing of internal links to split up file name, reference, and alias into distinct spans. This allows for proper hiding of internal link tokens when using the "Hide Markdown Tokens" feature
        • Fixed the handling of hashtags that include underscores
    • New: Collapse External Links
      • This features collapses external links (in edit mode) so that they only show the link name. The full link text will expand when clicking into the link.
    • Updated: Edit Mode Click Handler
      • This option has been updated to add a class to the div.cm-s-obsidian element whenever a modifier key is pressed
        • Currently supports ctrl (.HyperMD-with-ctrl), alt (.HyperMD-with-alt), meta (.HyperMD-with-meta)
        • This feature allows you to apply conditional CSS like changing the cursor to a pointer when hovering a link and also pressing ctrl/cmd
    • New: Set cursor blink rate
    Source code(tar.gz)
    Source code(zip)
    main.js(341.92 KB)
    manifest.json(311 bytes)
    obsidian-codemirror-options.zip(73.57 KB)
    styles.css(36.85 KB)
  • 0.1.4(Sep 26, 2021)

    0.1.4

    • Fixed a bug which would cause "can't read property 'length' of undefined" randomly, when opening files
    • Changed the code block copy button handling to account for the new default Obsidian copy button
    • Fixed a bug which would prevent CodeMirror options from applying to all open panes
    • Fixed a bug which would cause syntax highlighting to not apply sometimes in preview mode
    • Added highlight tokens (==) to the list of tokens hidden by the "Hide Tokens" feature
    • Stabilize Hide Markdown Tokens
      • The cursor placement logic has been replaced with a hopefully more stable method which prevents the scroll position from jumping up and down on click
      • The only outstanding cursor bug that I'm aware of is when placing the cursor to the right of the fold widget on a folded line
    Source code(tar.gz)
    Source code(zip)
    main.js(326.44 KB)
    manifest.json(328 bytes)
    obsidian-codemirror-options.zip(83.09 KB)
    styles.css(35.71 KB)
  • 0.1.3(Sep 13, 2021)

  • 0.1.1(Sep 11, 2021)

  • 0.1.0(Sep 11, 2021)

    0.1.0

    • Add an option to show line numbers in preview mode
    • Add an option to show a copy button on code blocks in preview mode
    • Fix the default font size for code blocks to 16px. This can be overridden using Style Settings
    • In preview mode, wrap code blocks in a <code> element to better mimic the original prism.js DOM structure.
      • The structure is now <div><pre><code></code></pre></div>
      • This change should hopefully be transparent for most use csses
    Source code(tar.gz)
    Source code(zip)
    main.js(321.17 KB)
    manifest.json(328 bytes)
    obsidian-codemirror-options.zip(81.85 KB)
    styles.css(35.38 KB)
  • 0.0.8(Sep 6, 2021)

Owner
null
A markdown editor using Electron, ReactJS, Vite, CodeMirror, and Remark

updated: Saturday, 5th February 2022 A modern looking application built with Electron-Vite-React ?? ✨ Markdown Editor Introduction This application s

Kryptonite 5 Sep 7, 2022
Customize your README.md file with ready-to-use sections in a simple way with the web editor

myreadme Customize your README.md file with ready-to-use sections in a simple way with the web editor Docker version Docker Hub docker run -p 7000:300

Nelson Hernández 7 Jul 25, 2022
UX plugin for Oxygen Builder

=== Recoda Workspace for Oxygen === Contributors: Renato Corluka Donate link: https://paypal.me/__insert_some_pp_me Tags: oxygen, oxygen builder, util

null 40 Dec 3, 2022
Rails plugin for Esbuild

?? esbuild-rails Rails plugin for Esbuild to help loading Stimulus controllers, ActionCable channels, and other Javascript. ⚙️ Installation Install wi

Chris Oliver 118 Dec 14, 2022
Template to create a new @Grafana application plugin.

Template to create a new Grafana application plugin Introduction The ABC Application is a template to create a new application plugin for Grafana. Req

Volkov Labs 5 Aug 17, 2022
Example VS Code plugin that uses embedded Omega Edit bindings to generate content

Ωedit Edit for VS Code Example VS Code plugin that uses embedded Omega Edit bindings to generate content. Build Requirements Bindings compiled against

Concurrent Technologies Corporation (CTC) 2 Nov 17, 2022
A Neos CMS plugin which provides a button editor

I13e.ButtonEditor Button editor for Neos CMS This package provides a new inspector editor displaying it's options as buttons. Buttons operates like ch

Ideenstadtwerke 9 Jun 10, 2022
WYSIWYG editor developed as jQuery plugin

RichText WYSIWYG editor developed as jQuery plugin. Requirements jQuery (v.3+, v.3.2+ recommended) FontAwesome (v.4.7.0 / v.5+) src/jquery.richtext.mi

Bob 95 Dec 30, 2022
Serialize arbitrary NodeJS closures and customize serialization behavior.

Closure Serializer This is a fork of the Pulumi Closure Serializer. @pulumi/pulumi. Motivation Functionless allows developers to write cloud applicati

null 4 Jul 19, 2022
⚡️The Fullstack React Framework — built on Next.js

The Fullstack React Framework "Zero-API" Data Layer — Built on Next.js — Inspired by Ruby on Rails Read the Documentation “Zero-API” data layer lets y

⚡️Blitz 12.5k Jan 4, 2023
Obsidian-Snippet-collection - A collection of snippet to customize obsidian

This repo is a collection of CSS snippets for Obsidian.md. To install them on PC

Mara 110 Dec 22, 2022
Prettier embeds for your YouTubes - with nice options like high-res preview images, advanced customization of embed options, and optional FitVids support.

PrettyEmbed.js Prettier embeds for your YouTubes - with nice options like high-res preview images, advanced customization of embed options, and option

Mike Zarandona 1.1k Sep 28, 2022
A plugin for Obsidian (https://obsidian.md) that adds a button to its search view for copying the Obsidian search URL.

Copy Search URL This plugin adds a button to Obsidian's search view. Clicking it will copy the Obsidian URL for the current search to the clipboard. T

Carlo Zottmann 6 Dec 26, 2022
Adds Syntax Highlighting & Hint for TiddlyWiki5 tiddlers (text/vnd.tiddlywiki) to the CodeMirror.

CodeMirror-Mode-TiddlyWiki5 Adds Syntax Highlighting for TiddlyWiki5 tiddlers (text/vnd.tiddlywiki) to the CodeMirror, along with some other useful ed

Ke Wang 18 Dec 30, 2022
A CodeMirror (v6) extension for adding relative line numbers to your code editor

Relative Line Numbers for CM6 Installation yarn add codemirror-line-numbers-relative Usage import { EditorView } from "@codemirror/view"; import { Edi

Joe Previte 5 Feb 7, 2022
A markdown editor using Electron, ReactJS, Vite, CodeMirror, and Remark

updated: Saturday, 5th February 2022 A modern looking application built with Electron-Vite-React ?? ✨ Markdown Editor Introduction This application s

Kryptonite 5 Sep 7, 2022
🦚 Beautiful themes for CodeMirror

ThemeMirror Beautiful themes for CodeMirror Install npm install thememirror

Vadim Demedes 119 Dec 27, 2022
A rugged, minimal framework for composing JavaScript behavior in your markup.

Alpine.js Alpine.js offers you the reactive and declarative nature of big frameworks like Vue or React at a much lower cost. You get to keep your DOM,

Alpine.js 22.5k Jan 2, 2023
A rugged, minimal framework for composing JavaScript behavior in your markup.

Alpine.js Alpine.js offers you the reactive and declarative nature of big frameworks like Vue or React at a much lower cost. You get to keep your DOM,

Alpine.js 22.5k Dec 30, 2022
Jason Johnston 2.8k Dec 26, 2022