Coder Social home page Coder Social logo

code-section's Introduction

Code Section Joplin Plug-in

This plug-in displays a piece of source code. It reads this source code from a source file which is appended to the note. The code is selected by supporting a code definition inside a code definition block.

The code definition looks as follows:

```codesection
{
"lang": "python",
"src": "CODE-SOURCE-APPENDIX",
"begin": 1,
"end": 50,
"expandTabs": true,
"tabSize": 4,
"lineNumbers": false
}
```

Several entries can be omitted and will be replaced by their defaults. The source language and the source itself are mandatory.

The inserted code will be displayed using the default renderer for that language including syntax highlighting.

This could look like this:

Python Source Code

Procedure

  1. Append a code source to the note
  2. Immediately following it add a codesection describing the code to be displayed
  3. The description has the shape of a JSON string
  4. The "src" attribute identifies the code source (its id followed by extension)
  5. Alternatively you could copy and paste the code insertion into the quotes of src

Problems

  1. The resource folder is not recognized after the start of Joplin. Workaround: Invoke the settings and then leave them
  2. Only local sources in the resource folder can be displayed, no web content
  3. The plug-in uses synchronous file access to read the source, no asynchronous access

Release Notes

1.0.7

  • Update of the Joplin API
  • Bug-fix: plug-in did not work without extension of the code file or with more than one dot in the file name

1.0.6

  • Changed architecture of the plug-in
  • Code Sections are printed now with export to pdf

1.0.5

  • Added a context menu command to insert a template of a code section
  • Added a few properties to the code section description:
    • scale: a scale factor in percent as 80% or absolute font size
    • spacing: the line spacing, default is 130% of the font size
    • height: the height of the code section window, may be "auto", "fill", a value in pixels ("400px") or a factor in percent relating to the window height

1.0.4

  • Fixed the bug where resource folder was not recognized. Workaround is no longer needed (see Problems 1.).

code-section's People

Contributors

mick2nd avatar

Stargazers

Charles Barr avatar There Is No TIme avatar EvanLabs avatar Nathan E. Lutterman avatar  avatar  avatar Lukas Labryszewski avatar b0rn-b0rked avatar  avatar

Watchers

 avatar

code-section's Issues

typo in the readme

Nice plugin.

The example codesection code block in the readme.md has an typo.
The last comma throws the error

"SyntaxError: Expected double-quoted property name in JSON at position ###"

Fix:

"lineNumbers": false,
should be
"lineNumbers": false

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.