Code Preview

by Hank
5
4
3
2
1
Score: 39/100

Description

Category: Coding & Technical Tools

The Code Preview plugin for Obsidian allows users to preview code directly from within their notes. By specifying a file path, users can display portions of the code, highlighting specific lines or sections based on configurable parameters. The plugin supports a variety of features such as line range selection, regular expression matching, and text-based search for highlighting code. It also includes options for customizing the appearance, such as line numbers and background color for highlights. Ideal for developers and anyone working with code in Obsidian, the plugin offers an easy way to visualize and navigate through code files without leaving the note-taking environment.

Reviews

No reviews yet.

Stats

38
stars
5,440
downloads
2
forks
1,254
days
1,216
days
1,216
days
3
total PRs
1
open PRs
2
closed PRs
0
merged PRs
12
total issues
6
open issues
6
closed issues
0
commits

Latest Version

3 years ago

Changelog

Fix

  • Update README.md example.zip link. #6
  • Amend RegExp example. #6

Chore

  • Update git action, add build plugin files.

README file from

Github

Obsidian Code Previews Plugin

中文

Example

Specific examples can be use Open folder as vault open example.zip.

Path

Code language is extname by path

The root path is Vault folder

CodeBlock language

Code language is extname by path

Language key: languagelang

Select display line range

custom start or end

end: "+1", config " is required.

/dd\d{2}/

If you don't know RegExp, just use text directly. like:

start: body: match body inside the line end: dd00dd: match dd00dd inside the line

Highlight

Separator ,.

YAML list

CodeBlock YAML config

Config Description Type Default
path file path string Required
start preview start line. Start with 1 number or string or RegExp -
end preview end line. number or string or RegExp -
highlight highlight lines number or string or RegExp -
linenumber display line Numbers, priority is greater than the plugin configuration true or false plugin config

Plugin configuration

Config Description Type Default
watchAlias Listening Alias folder changes, update input suggest. May affect performance boolean false
watchCode Listen to the previewed code file and update the render when the file changes. May affect performance boolean false
highLightColor highlight background css color #2d82cc20
include include path, Empty is All Array<string or RegExp> []
exclude exclude path Array<string or RegExp> ["node_modules", ".obsidian"]
includeFile include file, Required Array<string or RegExp> ["/\.js$/", "/\.css$/"]
excludeFile exclude file Array<string or RegExp> []
alias alias path string | Alias code
linenumber display linenumber true or false true

Thank

linenumber, highlight Based on obsidian-better-codeblock his implementation

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Highlightr
4 years ago by Chetachi
A minimal and aesthetically pleasing highlighting menu that makes color-coded highlighting much easier 🎨.
Annotator
5 years ago by Elias Sundqvist
A plugin for reading and annotating PDFs and EPUBs in obsidian.
PDF++
2 years ago by Ryota Ushio
PDF++: the most Obsidian-native PDF annotation & viewing tool ever. Comes with optional Vim keybindings.
Code Styler
3 years ago by Mayuran Visakan
A plugin for Obsidian.md for styling codeblocks and inline code
Codeblock Customizer
3 years ago by mugiwara
Codeblock Customizer plugin for Obsidian
AI Providers
a year ago by Pavel Frankov
This plugin is a hub for setting AI providers (OpenAI-like, Ollama and more) in one place.
Custom File Extensions and Types
3 years ago by MeepTech
An obsidian plugin allowing you to register and view different file extensions in a modular manner.
Keyword Highlighter
2 years ago by Marcel Goldammer
Automatically highlight specified keywords within your Obsidian notes for enhanced visibility and quick reference.
HiWords
7 months ago by Kai
Effortlessly grow your vocabulary as you read, with automatic highlighting and translation of unfamiliar words.
Always Color Text
8 months ago by Kazi Aidah Haque
Automatically colors texts across the Obsidian Vault!
Extended Markdown Syntax
a year ago by Kotaindah55
Extend your Markdown syntax using delimiters instead of HTML tags, such as underlining, superscript, subscript, highlighting, and spoiler.
Note Annotations
a year ago by Jan Beck
Occura
2 years ago by Alexey Sedoykin
Plugin for https://obsidian.md/ that automatically selected same text occurrences in opened note
GDScript Syntax Highlighting
2 years ago by RobTheFiveNine
Adds live GDScript syntax highlighting to code blocks in the Obsidian editor.
Sentence Rhythm
a year ago by Adam Fletcher
Obsidian plugin added toggleable colored highlights to sentences based on their length
Code Link
2 years ago by observerw
Display code in Obsidian, and only the part you're interested in!
Long sentence highlighter
8 months ago by Robert Meißner
Interactive Code Blocks
2 years ago by Student Assistenten Team Deeltaken