### Shell Script Example: Git Clone and Server Setup
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/shell/index.html
A shell script demonstrating cloning a Git repository, generating HTTPS credentials, and starting a Node.js server in HTTPS mode. This is useful for setting up a development environment.
```shell
#!/bin/bash
# clone the repository
git clone http://github.com/garden/tree
# generate HTTPS credentials
cd tree
openssl genrsa -aes256 -out https.key 1024
openssl req -new -nodes -key https.key -out https.csr
openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt
cp https.key{,.orig}
openssl rsa -in https.key.orig -out https.key
# start the server in HTTPS mode
cd web
sudo node ../server.js 443 'yes' >> ../node.log &
# here is how to stop the server
for pid in `ps aux | grep 'node ../server.js' | awk '{print $2}'` ;
do
sudo kill -9 $pid 2> /dev/null
done
exit 0
```
--------------------------------
### LiveScript Prelude Installation
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/livescript/index.html
Installs the LiveScript prelude into a target object if it's not already installed.
```livescript
# meta
export installPrelude = !(target) -> unless target.prelude?isInstalled target <<< out$
# using out$ generated by livescript
target <<< target.prelude.isInstalled = true
```
```livescript
export prelude = out$
```
--------------------------------
### Imperative Nix Installation
Source: https://github.com/amperser/proselint/blob/main/README.md
Install Proselint imperatively using the nix profile command.
```bash
nix profile install nixpkgs#proselint
```
--------------------------------
### Install proselint using pip
Source: https://github.com/amperser/proselint/blob/main/plugins/sublime/SublimeLinter-contrib-proselint/README.md
Install the proselint linter using pip. Ensure Python and pip are installed first. This command may require sudo privileges.
```bash
[sudo] pip install proselint
```
--------------------------------
### Set up Development Environment with uv
Source: https://github.com/amperser/proselint/blob/main/CONTRIBUTING.md
Install development and testing tools using uv for non-Nix systems. Ensure you have uv installed first.
```bash
uv sync --locked --dev --all-extras --group test
```
--------------------------------
### Install Proselint on Ubuntu
Source: https://github.com/amperser/proselint/blob/main/README.md
Install Proselint on Ubuntu systems using apt. This requires enabling the universe repository.
```bash
sudo add-apt-repository universe
sudo apt install python3-proselint
```
--------------------------------
### Install Proselint using pip
Source: https://github.com/amperser/proselint/blob/main/README.md
Use this command to install Proselint via pip. Ensure pip is installed and up-to-date.
```bash
pip install proselint
```
--------------------------------
### Install Proselint on Debian
Source: https://github.com/amperser/proselint/blob/main/README.md
Install Proselint on Debian systems using apt. Ensure the universe repository is enabled.
```bash
sudo apt install python3-proselint
```
--------------------------------
### VBScript Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/vbscript/index.html
A basic VBScript example demonstrating constants and a subroutine. This code is for VBScript syntax highlighting.
```vbscript
' Pete Guhl ' 03-04-2012 ' ' Basic VBScript support for codemirror2 Const ForReading = 1, ForWriting = 2, ForAppending = 8 Call Sub020_PostBroadcastToUrbanAirship(strUserName, strPassword, intTransmitID, strResponse) If Not IsNull(strResponse) AND Len(strResponse) = 0 Then boolTransmitOkYN = False Else ' WScript.Echo "Oh Happy Day! Oh Happy DAY!" boolTransmitOkYN = True End If
```
--------------------------------
### YAML List Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/yaml/index.html
Demonstrates a simple YAML list structure for items like movies.
```yaml
---
# Favorite movies
- Casablanca
- North by Northwest
- The Man Who Wasn't There
---
```
--------------------------------
### Pascal Syntax Examples
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/pascal/index.html
Illustrates common Pascal control flow structures and syntax elements for highlighting.
```pascal
(\* Example Pascal code \*) while a <> b do writeln('Waiting'); if a > b then writeln('Condition met') else writeln('Condition not met'); for i := 1 to 10 do writeln('Iteration: ', i:1); repeat a := a + 1 until a = 10; case i of 0: write('zero'); 1: write('one'); 2: write('two') end;
```
--------------------------------
### Install Proselint on Fedora
Source: https://github.com/amperser/proselint/blob/main/README.md
Install Proselint on Fedora systems using the dnf package manager.
```bash
sudo dnf install proselint
```
--------------------------------
### Example proselint suggestion
Source: https://github.com/amperser/proselint/blob/main/site/_posts/2014-06-10-utility.md
An example of a specific suggestion from proselint, detailing the location and nature of the writing issue.
```bash
text.md:0:10: wallace.uncomparables Comparison of an uncomparable: 'unique' cannot be compared.
```
--------------------------------
### Install Jekyll
Source: https://github.com/amperser/proselint/blob/main/site/README.md
Install the Jekyll static site generator using RubyGems. Ensure you have Ruby and RubyGems installed first.
```bash
$ gem install jekyll
```
--------------------------------
### Underscore.coffee Header and Setup
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/coffeescript/index.html
Includes the header comments, license information, and baseline setup for the Underscore.js library in CoffeeScript.
```coffeescript
# CoffeeScript mode for CodeMirror # Copyright (c) 2011 Jeff Pickhardt, released under # the MIT License. # # Modified from the Python CodeMirror mode, which also is # under the MIT License Copyright (c) 2010 Timothy Farrell. # # The following script, Underscore.coffee, is used to # demonstrate CoffeeScript mode for CodeMirror. # # To download CoffeeScript mode for CodeMirror, go to: # https://github.com/pickhardt/coffeescript-codemirror-mode # **Underscore.coffee # (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.** # Underscore is freely distributable under the terms of the # [MIT license](http://en.wikipedia.org/wiki/MIT_License). # Portions of Underscore are inspired by or borrowed from # [Prototype.js](http://prototypejs.org/api), Oliver Steele's # [Functional](http://osteele.com), and John Resig's # [Micro-Templating](http://ejohn.org). # For all details and documentation: # http://documentcloud.github.com/underscore/
```
```coffeescript
# Baseline setup # -------------- # Establish the root object, `window` in the browser, or `global` on the server. root = this # Save the previous value of the `_` variable. previousUnderscore = root._
```
```coffeescript
### Multiline comment ### # Establish the object that gets thrown to break out of a loop iteration. # `StopIteration` is SOP on Mozilla. breaker = if typeof(StopIteration) is 'undefined' then '__break__' else StopIteration
```
```coffeescript
#### Docco style single line comment (title) # Helper function to escape **RegExp** contents, because JS doesn't have one. escapeRegExp = (string) -> string.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1')
```
```coffeescript
# Save bytes in the minified (but not gzipped) version: ArrayProto = Array.prototype ObjProto = Object.prototype # Create quick reference variables for speed access to core prototypes. slice = ArrayProto.slice unshift = ArrayProto.unshift toString = ObjProto.toString hasOwnProperty = ObjProto.hasOwnProperty propertyIsEnumerable = ObjProto.propertyIsEnumerable
```
```coffeescript
# All **ECMA5** native implementations we hope to use are declared here. nativeForEach = Array.prototype.forEach nativeMap = Array.prototype.map nativeReduce = Array.prototype.reduce nativeReduceRight = Array.prototype.reduceRight nativeFilter = Array.prototype.filter nativeEvery = Array.prototype.every nativeSome = Array.prototype.some nativeIndexOf = Array.prototype.indexOf nativeLastIndexOf = Array.prototype.lastIndexOf nativeIsArray = Array.isArray nativeKeys = Object.keys
```
```coffeescript
# Create a safe reference to the Underscore object for use below. _ = (obj) -> new wrapper(obj) # Export the Underscore object for **CommonJS**. if typeof(exports) != 'undefined' then exports._ = _ # Export Underscore to global scope. root._ = _ # Current version. _.VERSION = '1.1.0'
```
--------------------------------
### XQuery Basic Syntax Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/xquery/index.html
Demonstrates basic XQuery syntax including comments, let bindings, element constructors, and function calls.
```xquery
xquery version "1.0-ml"; (: this is : a "comment" :)
let $let := "test"function() $var {function()} {$var}
let $joe:=1
return element element { attribute attribute { 1 }, element test { 'a' }, attribute foo { "bar" }, fn:doc()[
foo/@bar eq $let
], //x
} (: a more 'evil' test :)
(: Modified Blakeley example (: with nested comment :) ... :)
declare private function local:declare() {()};
declare private function local:private() {()};
declare private function local:function() {()};
declare private function local:local() {()};
let $let := let $let := "let"
return element element { attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } }, attribute fn:doc { "bar" castable as xs:string }, element text { text { "text" } }, fn:doc()[
child::eq/(@bar | attribute::attribute) eq $let
], //fn:doc
```
--------------------------------
### Declarative Nix Installation
Source: https://github.com/amperser/proselint/blob/main/README.md
Add Proselint to your system packages declaratively using Nix.
```nix
environment.systemPackages = [pkgs.proselint];
```
--------------------------------
### YAML Shopping List Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/yaml/index.html
Shows a YAML list used for a shopping list.
```yaml
---
# Shopping list
[milk, pumpkin pie, eggs, juice]
---
```
--------------------------------
### Jinja2 HTML Template Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/jinja2/index.html
Demonstrates Jinja2 syntax within an HTML structure, including comments and a for loop.
```html
Jinja2 Example {# this is a comment #} {%- for item in li -%} - {{ item.label }}
{% endfor -%}
```
--------------------------------
### Mustache Template Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/demo/mustache.html
An example of an HTML structure with Mustache templating syntax for dynamic content insertion.
```html
{{title}}
These are links to {{things}}:
```
--------------------------------
### Smalltalk Code Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/smalltalk/index.html
A basic example of a Smalltalk class definition for a counter component, demonstrating initialization, state management, and rendering.
```Smalltalk
" This is a test of the Smalltalk code " Seaside.WAComponent subclass: #MyCounter \
| count |
MyCounter class >> canBeRoot
^true
initialize
super initialize.
count := 0.
states
^ { self }
renderContentOn: html
html heading: count.
html anchor callback: [
count := count + 1
]; with: '++'.
html space.
html anchor callback: [
count := count - 1
]; with: '--'.
```
--------------------------------
### PHP and HTML Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/php/index.html
Demonstrates how PHP code is embedded within an HTML structure and rendered.
```php
The program says = hello("World") ?>.
```
--------------------------------
### Asterisk Dialplan Configuration Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/asterisk/index.html
This snippet shows a typical Asterisk extensions.conf file structure, including general settings, context definitions, and various extension examples for call routing, voicemail, and testing.
```asterisk
; extensions.conf - the Asterisk dial plan
; [general]
;
; If static is set to no, or omitted, then the pbx_config will rewrite
; this file when extensions are modified. Remember that all comments
; made in the file will be lost when that happens.
static=yes
#include "/etc/asterisk/additional_general.conf"
[iaxprovider]
switch => IAX2/user:[key]@myserver/mycontext
[dynamic]
#exec /usr/bin/dynamic-peers.pl
[trunkint]
; International long distance through trunk
exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})})
[local]
; Master context for local, toll-free, and iaxtel calls only
ignorepat => 9
include => default
[demo]
include => stdexten
; We start with what to do when a call first comes in.
exten => s,1,Wait(1) ; Wait a second, just for fun
same => n,Answer ; Answer the line
same => n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds
same => n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds
same => n(restart),BackGround(demo-congrats) ; Play a congratulatory message
same => n(instruct),BackGround(demo-instruct) ; Play some instructions
same => n,WaitExten ; Wait for an extension to be dialed.
exten => 2,1,BackGround(demo-moreinfo) ; Give some more information.
exten => 2,n,Goto(s,instruct)
exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french
exten => 3,n,Goto(s,restart) ; Start with the congratulations
exten => 1000,1,Goto(default,s,1) ;
; We also create an example user, 1234, who is on the console and has
; voicemail, etc.
;
exten => 1234,1,Playback(transfer,skip) ; "Please hold while..."
; (but skip if channel is not up)
exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)}))
exten => 1234,n,Goto(default,s,1) ; exited Voicemail
exten => 1235,1,Voicemail(1234,u) ; Right to voicemail
exten => 1236,1,Dial(Console/dsp) ; Ring forever
exten => 1236,n,Voicemail(1234,b) ; Unless busy
; # for when they're done with the demo
;
exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo"
exten => #,n,Hangup ; Hang them up.
; A timeout and "invalid extension rule"
;
exten => t,1,Goto(#,1) ; If they take too long, give up
exten => i,1,Playback(invalid) ; "That's not valid, try again"
; Create an extension, 500, for dialing the
; Asterisk demo.
;
exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default) ; Call the Asterisk demo
exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site
exten => 500,n,Goto(s,6) ; Return to the start over message.
; Create an extension, 600, for evaluating echo latency.
;
exten => 600,1,Playback(demo-echotest) ; Let them know what's going on
exten => 600,n,Echo ; Do the echo test
exten => 600,n,Playback(demo-echodone) ; Let them know it's over
exten => 600,n,Goto(s,6) ; Start over
; You can use the Macro Page to intercom a individual user
exten => 76245,1,Macro(page,SIP/Grandstream1) ; or if your peernames are the same as extensions
exten => _7XXX,1,Macro(page,SIP/${EXTEN})
; System Wide Page at extension 7999
;
exten => 7999,1,Set(TIMEOUT(absolute)=60)
exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n)
; Give voicemail at extension 8500
;
exten => 8500,1,VoicemailMain
exten => 8500,n,Goto(s,6)
```
--------------------------------
### TypeScript Greeter Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/javascript/typescript.html
Demonstrates a simple TypeScript class and its usage, including DOM manipulation for a button that triggers an alert.
```typescript
class Greeter { greeting: string; constructor (message: string) { this.greeting = message; } greet() { return "Hello, " + this.greeting; } } var greeter = new Greeter("world"); var button = document.createElement('button') button.innerText = "Say Hello" button.onclick = function() { alert(greeter.greet()) } document.body.appendChild(button)
```
--------------------------------
### HTTP Request Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/http/index.html
This is an example of an HTTP request formatted for the CodeMirror HTTP mode. It includes the request line, headers, and a body.
```http
POST /somewhere HTTP/1.1
Host: example.com
If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
Content-Type: application/x-www-form-urlencoded; charset=utf-8
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11
This is the request body!
```
--------------------------------
### SPARQL Query Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/sparql/index.html
A sample SPARQL query demonstrating basic syntax, prefixes, SELECT, WHERE clauses, OPTIONAL, and FILTER.
```sparql
PREFIX a:
PREFIX dc:
PREFIX foaf:
# Comment!
SELECT ?given ?family
WHERE {
?annot a:annotates .
?annot dc:creator ?c .
OPTIONAL {
?c foaf:given ?given ;
foaf:family ?family
} .
FILTER isBlank(?c)
}
```
--------------------------------
### Elementary functions in OCaml
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/ocaml/index.html
Provides examples of basic mathematical functions: squaring a number and calculating factorial.
```ocaml
let square x = x * x
;;
let rec fact x = if x <= 1 then 1 else x * fact (x - 1)
;;
```
--------------------------------
### Verilog Module Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/verilog/index.html
This is a Verilog code example demonstrating a butterfly module. It includes parameter definitions, input/output ports, and internal logic for complex number multiplication and delay.
```verilog
/* Verilog demo code */ module butterfly #(
parameter WIDTH = 32,
parameter MWIDTH = 1
) (
input wire clk,
input wire rst_n,
// m_in contains data that passes through this block with no change.
input wire [MWIDTH-1:0] m_in,
// The twiddle factor.
input wire signed [WIDTH-1:0] w,
// XA input wire signed [WIDTH-1:0] xa,
// XB input wire signed [WIDTH-1:0] xb,
// Set to 1 when new data is present on inputs.
input wire x_nd,
// delayed version of m_in.
output reg [MWIDTH-1:0] m_out,
// YA = XA + W*XB
// YB = XA - W*XB
output wire signed [WIDTH-1:0] ya,
output wire signed [WIDTH-1:0] yb,
output reg y_nd,
output reg error
);
// Set wire to the real and imag parts for convenience.
wire signed [WIDTH/2-1:0] xa_re;
wire signed [WIDTH/2-1:0] xa_im;
assign xa_re = xa[WIDTH-1:WIDTH/2];
assign xa_im = xa[WIDTH/2-1:0];
wire signed [WIDTH/2-1: 0] ya_re;
wire signed [WIDTH/2-1: 0] ya_im;
assign ya = {ya_re, ya_im};
wire signed [WIDTH/2-1: 0] yb_re;
wire signed [WIDTH/2-1: 0] yb_im;
assign yb = {yb_re, yb_im};
// Delayed stuff.
reg signed [WIDTH/2-1:0] xa_re_z;
reg signed [WIDTH/2-1:0] xa_im_z;
// Output of multiplier
wire signed [WIDTH-1:0] xbw;
wire signed [WIDTH/2-1:0] xbw_re;
wire signed [WIDTH/2-1:0] xbw_im;
assign xbw_re = xbw[WIDTH-1:WIDTH/2];
assign xbw_im = xbw[WIDTH/2-1:0];
// Do summing
// I don't think we should get overflow here because of the
// size of the twiddle factors.
// If we do testing should catch it.
assign ya_re = xa_re_z + xbw_re;
assign ya_im = xa_im_z + xbw_im;
assign yb_re = xa_re_z - xbw_re;
assign yb_im = xa_im_z - xbw_im;
// Create the multiply module.
multiply_complex #(WIDTH) multiply_complex_0 (
.clk(clk),
.rst_n(rst_n),
.x(xb),
.y(w),
.z(xbw)
);
always @ (posedge clk) begin
if (!rst_n) begin
y_nd <= 1'b0;
error <= 1'b0;
end else begin
// Set delay for x_nd_old and m.
y_nd <= x_nd;
m_out <= m_in;
if (x_nd) begin
xa_re_z <= xa_re/2;
xa_im_z <= xa_im/2;
end
end
end
endmodule
```
--------------------------------
### Setup CodeMirror Autocomplete
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/demo/complete.html
Defines the autocomplete command and initializes the CodeMirror editor with autocompletion enabled. Press Ctrl-Space to activate.
```javascript
CodeMirror.commands.autocomplete = function(cm) { CodeMirror.showHint(cm, CodeMirror.javascriptHint); }
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
extraKeys: {"Ctrl-Space": "autocomplete"}
});
```
--------------------------------
### Sass Code Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/sass/index.html
Demonstrates typical Sass syntax including variable definitions, global attributes, and scoped styles.
```sass
// Variable Definitions
$page-width: 800px
$sidebar-width: 200px
$primary-color: #eeeeee
// Global Attributes
body {
font: {
family: sans-serif;
size: 30em;
weight: bold;
}
}
// Scoped Styles
#contents {
width: $page-width;
}
#sidebar {
float: right;
width: $sidebar-width;
}
#main {
width: $page-width - $sidebar-width;
background: $primary-color;
}
h2 {
color: blue;
}
#footer {
height: 200px;
}
```
--------------------------------
### RPM Spec File Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/rpm/spec/index.html
A standard RPM spec file demonstrating the structure and common directives used in RPM packaging.
```rpm-spec
# # spec file for package minidlna # # Copyright (c) 2011, Sascha Peilicke # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. Name: libupnp6 Version: 1.6.13 Release: 0 Summary: Portable Universal Plug and Play (UPnP) SDK Group: System/Libraries License: BSD-3-Clause Url: http://sourceforge.net/projects/pupnp/ Source0: http://downloads.sourceforge.net/pupnp/libupnp-%{version}.tar.bz2 BuildRoot: %{\_tmppath}/%{name}-%{version}-build %description The portable Universal Plug and Play (UPnP) SDK provides support for building UPnP-compliant control points, devices, and bridges on several operating systems. %package -n libupnp-devel Summary: Portable Universal Plug and Play (UPnP) SDK Group: Development/Libraries/C and C++ Provides: pkgconfig(libupnp) Requires: %{name} = %{version} %description -n libupnp-devel The portable Universal Plug and Play (UPnP) SDK provides support for building UPnP-compliant control points, devices, and bridges on several operating systems. %prep %setup -n libupnp-%{version} %build %configure --disable-static make %{?_smp_mflags} %install %makeinstall find %{buildroot} -type f -name '\*.la' -exec rm -f {} \; %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-,root,root,-) %doc ChangeLog NEWS README TODO %{\_libdir}/libixml.so.\* %{\_libdir}/libthreadutil.so.\* %{\_libdir}/libupnp.so.\* %files -n libupnp-devel %defattr(-,root,root,-) %{\_libdir}/pkgconfig/libupnp.pc %{\_libdir}/libixml.so %{\_libdir}/libthreadutil.so %{\_libdir}/libupnp.so %{\_includedir}/upnp/ %changelog
```
--------------------------------
### Markdown Link Syntax Examples
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/markdown/index.html
Demonstrates inline and reference-style link syntax in Markdown, including optional title attributes.
```markdown
[link text](http://example.com/ "Title")
```
```markdown
I get 10 times more traffic from [Google][1] than from [Yahoo][2] or [MSN][3].
[1]: http://google.com/ "Google"
[2]: http://search.yahoo.com/ "Yahoo Search"
[3]: http://search.msn.com/ "MSN Search"
```
```markdown
I start my morning with a cup of coffee and [The New York Times][NY Times].
[ny times]: http://www.nytimes.com/
```
--------------------------------
### Run proselint on a file
Source: https://github.com/amperser/proselint/blob/main/site/_posts/2014-06-10-utility.md
Execute the proselint command-line tool on a specified file to get writing suggestions.
```bash
❯ proselint text.md
```
--------------------------------
### HTML Mixed Mode Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/htmlmixed/index.html
A sample HTML document demonstrating the mixed mode, including embedded CSS and JavaScript.
```html
Mixed HTML Example Mixed HTML Example
```
--------------------------------
### Set up Development Environment with Nix
Source: https://github.com/amperser/proselint/blob/main/CONTRIBUTING.md
Use this command to prepare your environment if you are using Nix.
```bash
nix develop
```
--------------------------------
### NTriples Example Data
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/ntriples/index.html
An example of data formatted according to the NTriples specification.
```text
. "literal 1" . \_:bnode3 . \_:bnode4 "literal 2"@lang . \_:bnode5 "literal 3"^^ .
```
--------------------------------
### XML Example HTML
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/xml/index.html
An example of XML/HTML content that the CodeMirror XML mode can parse.
```html
HTML Example The indentation tries to be somewhat "do what I mean"... but might not match your style.
```
--------------------------------
### LESS CSS Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/less/index.html
This is an example of LESS CSS syntax, showcasing nested rules, variables, and mixins.
```css
} .class, .special { color: hsl(190, 20%, 50%) } } } #guide { background-color: @darkest; .content { background-color: transparent; } } #about { background-color: @darkest !important; .content { background-color: desaturate(lighten(@darkest, 3%), 5%); } } #synopsis { background-color: desaturate(lighten(@darkest, 3%), 5%) !important; .content { background-color: desaturate(lighten(@darkest, 3%), 5%); } pre {} } #synopsis, #guide { .content { .box-shadow(0, 0px, 0px, 0.0); } } #about footer { margin-top: 30px; padding-top: 30px; border-top: 6px solid rgba(0, 0, 0, 0.1); text-align: center; font-size: 16px; color: rgba(255, 255, 255, 0.35); #copy { font-size: 12px } text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.02); }
```
--------------------------------
### LESS Syntax Highlighting Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/less/index.html
Demonstrates basic LESS syntax including variables, nested rules, and color manipulation. This is useful for understanding how LESS code is parsed and displayed.
```less
h2 {
span {
color: @medium;
}
color: @blue + #333;
display: inline;
float: left;
margin: 36px 0 0 15px
}
h3 {
color: @blue;
line-height: 1.4em;
margin: 30px 0 15px 0;
font-size: 1em;
text-shadow: 0px 0px 0px @lightest;
span {
color: @medium
}
}
#example {
p {
font-size: 18px;
color: @blue;
font-weight: bold;
text-shadow: 0px 1px 1px @lightest;
}
pre {
margin: 0;
text-shadow: 0 -1px 1px @darkest;
margin-top: 20px;
background-color: desaturate(@darkest, 8%);
border: 0;
width: 450px;
color: lighten(@lightest, 2%);
background-repeat: repeat;
padding: 15px;
border: 1px dashed @lightest;
line-height: 15px;
.box-shadow(0, 0px, 15px, 0.5);
.code;
.border-radius(2px);
code .attribute {
color: hsl(40, 50%, 70%)
}
code .variable {
color: hsl(120, 10%, 50%)
}
code .element {
color: hsl(170, 20%, 50%)
}
code .string, .regexp {
color: hsl(75, 50%, 65%)
}
code .class {
color: hsl(40, 40%, 60%);
font-weight: normal
}
code .id {
color: hsl(50, 40%, 60%);
font-weight: normal
}
code .comment {
color: rgba(255, 255, 255, 0.2)
}
code .number, .color {
color: hsl(10, 40%, 50%)
}
code .class, code .mixin, .special {
color: hsl(190, 20%, 50%)
}
}
#time {
color: #aaa
}
}
.page {
.content {
width: 870px;
padding: 45px;
}
margin: 0 auto;
font-family: 'Georgia', serif;
font-size: 18px;
line-height: 26px;
padding: 0 60px;
code {
font-size: 16px;
}
pre {
border-width: 1px;
border-style: dashed;
padding: 15px;
margin: 15px 0;
}
h1 {
text-align: left;
font-size: 40px;
margin-top: 15px;
margin-bottom: 35px;
}
p + h1 {
margin-top: 60px
}
h2,
h3 {
margin: 30px 0 15px 0;
}
p + h2,
pre + h2,
code + h2 {
border-top: 6px solid rgba(255, 255, 255, 0.1);
padding-top: 30px;
}
h3 {
margin: 15px 0;
}
}
#docs {
@bg: lighten(@light-blue, 5%);
border-top: 2px solid lighten(@bg, 5%);
color: @blue;
background-color: @light-blue;
.box-shadow(0, -2px, 5px, 0.2);
h1 {
font-family: 'Droid Serif', 'Georgia', serif;
padding-top: 30px;
padding-left: 45px;
font-size: 44px;
text-align: left;
margin: 30px 0 !important;
text-shadow: 0px 1px 1px @lightest;
font-weight: bold;
}
.content {
clear: both;
border-color: transparent;
background-color: lighten(@light-blue, 25%);
.box-shadow(0, 5px, 5px, 0.4);
}
pre {
@background: lighten(@bg, 30%);
color: lighten(@blue, 10%);
background-color: @background;
border-color: lighten(@light-blue, 25%);
border-width: 2px;
code .attribute {
color: hsl(40, 50%, 30%)
}
code .variable {
color: hsl(120, 10%, 30%)
}
code .element {
color: hsl(170, 20%, 30%)
}
code .string, .regexp {
color: hsl(75, 50%, 35%)
}
code .class {
color: hsl(40, 40%, 30%);
font-weight: normal
}
code .id {
color: hsl(50, 40%, 30%);
font-weight: normal
}
code .comment {
color: rgba(0, 0, 0, 0.4)
}
code .number, .color {
color: hsl(10, 40%, 30%)
}
code .class, code .mixin, .special {
color: hsl(190, 20%, 30%)
}
}
pre code {
font-size: 15px
}
p + h2,
pre + h2,
code + h2 {
border-top-color: rgba(0, 0, 0, 0.1)
}
}
td {
padding-right: 30px;
}
#synopsis {
.box-shadow(0, 5px, 5px, 0.2);
}
#synopsis,
#about {
h2 {
font-size: 30px;
padding: 10px 0;
}
h1 + h2 {
margin-top: 15px;
}
h3 {
font-size: 22px
}
.code-example {
border-spacing: 0;
border-width: 1px;
border-style: dashed;
padding: 0;
pre {
border: 0;
margin: 0
}
td {
border: 0;
margin: 0;
background-color: desaturate(darken(@darkest, 5%), 20%);
vertical-align: top;
padding: 0;
}
tr {
padding: 0
}
}
.css-output {
td {
border-left: 0;
}
}
.less-example {
//border-right: 1px dotted rgba(255, 255, 255, 0.5) !important;
}
.css-output,
.less-example {
width: 390px;
}
pre {
padding: 20px;
line-height: 20px;
font-size: 14px;
}
}
#about,
#synopsis,
#guide {
a {
text-decoration: none;
color: @light-yellow;
border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
&:hover {
text-decoration: none;
border-bottom: 1px dashed @light-yellow;
}
}
@bg: desaturate(darken(@darkest, 5%), 20%);
text-shadow: 0 -1px 1px lighten(@bg, 5%);
color: @highlight;
background-color: @bg;
.content {
background-color: desaturate(@darkest, 20%);
clear: both;
.box-shadow(0, 5px, 5px, 0.4);
}
h1,
h2,
h3 {
color: @dark-yellow;
}
pre {
code .attribute {
color: hsl(40, 50%, 70%)
}
code .variable {
color: hsl(120, 10%, 50%)
}
code .element {
color: hsl(170, 20%, 50%)
}
code .string, .regexp {
color: hsl(75, 50%, 65%)
}
code .class {
color: hsl(40, 40%, 60%);
font-weight: normal
}
code .id {
color: hsl(50, 40%, 60%);
font-weight: normal
}
code .comment {
color: rgba(255, 255, 255, 0.2)
}
code .number, .color {
color: hsl(10, 40%, 50%)
}
code .class, code .mixin, .special {
color: hsl(190, 20%, 50%)
}
background-color: @bg;
border-color: darken(@light-yellow, 5%);
}
code {
color: darken(@dark-yellow, 5%);
.string, .regexp {
color: desaturate(@light-blue, 15%)
}
.keyword {
color: hsl(40, 40%, 60%);
font-weight: normal
}
.comment {
color: rgba(255, 255, 255, 0.2)
}
.number {
color: lighten(@blue, 10%)
}
}
}
```
--------------------------------
### Go Prime Sieve Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/go/index.html
Demonstrates a prime sieve algorithm implemented in Go, as taken from the Go specification. This code showcases concurrency patterns using channels.
```go
// Prime Sieve in Go. // Taken from the Go specification. // Copyright © The Go Authors. package main import "fmt" // Send the sequence 2, 3, 4, ... to channel 'ch'. func generate(ch chan<- int) { for i := 2; ; i++ { ch <- i // Send 'i' to channel 'ch' } } // Copy the values from channel 'src' to channel 'dst', // removing those divisible by 'prime'. func filter(src <-chan int, dst chan<- int, prime int) { for i := range src { // Loop over values received from 'src'. if i%prime != 0 { dst <- i // Send 'i' to channel 'dst'. } } } // The prime sieve: Daisy-chain filter processes together. func sieve() { ch := make(chan int) // Create a new channel. go generate(ch) // Start generate() as a subprocess. for { prime := <-ch fmt.Print(prime, "\n") ch1 := make(chan int) go filter(ch, ch1, prime) ch = ch1 } } func main() { sieve() }
```
--------------------------------
### Serve Jekyll Site
Source: https://github.com/amperser/proselint/blob/main/site/README.md
Start the Jekyll development server. Use the --watch option to automatically rebuild the site when files change.
```bash
$ jekyll serve --watch
```
--------------------------------
### Z80 Assembly Code Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/z80/index.html
Example of Z80 assembly code for TI-83 Plus, demonstrating initialization and string display.
```z80
#include "ti83plus.inc"
#define progStart $9D95
.org progStart-2
.db $BB,$6D
bcall(_ClrLCDFull)
ld HL, 0
ld (PenCol), HL
ld HL, Message
bcall(_PutS) ; Displays the string
bcall(_NewLine)
ret
Message:
.db "Hello world!",0
```
--------------------------------
### Triangle rendering with OpenGL and Glut in OCaml
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/ocaml/index.html
Initializes OpenGL and Glut, sets up a display function to render a rotating triangle, and enters the main loop.
```ocaml
let () = ignore( Glut.init Sys.argv )
;;
Glut.initDisplayMode ~double_buffer:true ()
;;
ignore ( Glut.createWindow ~title:"OpenGL Demo" )
;;
let angle t = 10. *. t *. t
;;
let render () =
GlClear.clear [ `color ]
;;
GlMat.load_identity ()
;;
GlMat.rotate ~angle:(angle (Sys.time ())) ~z:1. ()
;;
GlDraw.begins `triangles
;;
List.iter GlDraw.vertex2 [-1., -1.; 0., 1.; 1., -1.]
;;
GlDraw.ends ()
;;
Glut.swapBuffers ()
;;
GlMat.mode `modelview
;;
Glut.displayFunc ~cb:render
;;
Glut.idleFunc ~cb:(Some Glut.postRedisplay)
;;
Glut.mainLoop ()
;;
```
--------------------------------
### Embedded Scheme Code Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/demo/changemode.html
An example of Scheme code embedded within the HTML, which would be recognized by the mode-switching logic.
```scheme
(define (double x) (* x x))
```
--------------------------------
### Initial Buffer Loading and Editor Setup
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/demo/buffers.html
Loads initial 'js' and 'css' buffers from DOM content and initializes two CodeMirror editors in a split view.
```javascript
openBuffer("js", nodeContent("script"), "javascript"); openBuffer("css", nodeContent("style"), "css"); var ed_top = CodeMirror(document.getElementById("code_top"), {lineNumbers: true}); selectBuffer(ed_top, "js"); var ed_bot = CodeMirror(document.getElementById("code_bot"), {lineNumbers: true}); selectBuffer(ed_bot, "js");
```
--------------------------------
### ECL Syntax Highlighting Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/ecl/index.html
Demonstrates ECL syntax with comments and basic code structures. This is useful for testing or showcasing the ECL mode's capabilities.
```ecl
/* sample useless code to demonstrate ecl syntax highlighting this is a multiline comment! */ // this is a singleline comment!
import ut;
r := record
string22 s1 := '123';
integer4 i1 := 123;
end;
#option('tmp', true);
d := dataset('tmp::qb', r, thor);
output(d);
```
--------------------------------
### Turtle Syntax Example
Source: https://github.com/amperser/proselint/blob/main/plugins/webeditor/codemirror/mode/turtle/index.html
An example of Turtle syntax, commonly used for RDF data serialization. This is useful for understanding the expected input for the Turtle mode.
```turtle
@prefix foaf: .
@prefix geo: .
@prefix rdf: .
a foaf:Person;
foaf:interest ;
foaf:based_near [
geo:lat "34.0736111" ;
geo:lon "-118.3994444"
]
```