or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

tessl/npm-remark-preset-lint-recommended

A remark preset to configure remark-lint with rules that prevent mistakes or stuff that fails across vendors.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/remark-preset-lint-recommended@6.1.x

To install, run

npx @tessl/cli install tessl/npm-remark-preset-lint-recommended@6.1.0

0

# remark-preset-lint-recommended

1

2

remark-preset-lint-recommended is a unified (remark) preset that configures remark-lint with a curated collection of rules designed to prevent mistakes and ensure consistent markdown rendering across different vendors. It provides a standardized approach to markdown linting with rules for Unix compatibility, consistent formatting, and common mistake prevention.

3

4

## Package Information

5

6

- **Package Name**: remark-preset-lint-recommended

7

- **Package Type**: npm

8

- **Language**: JavaScript (ES Module)

9

- **Installation**: `npm install remark-preset-lint-recommended`

10

11

### Alternative Installation Methods

12

13

**Deno:**

14

```javascript

15

import remarkPresetLintRecommended from 'https://esm.sh/remark-preset-lint-recommended@6';

16

```

17

18

**Browser:**

19

```html

20

<script type="module">

21

import remarkPresetLintRecommended from 'https://esm.sh/remark-preset-lint-recommended@6?bundle';

22

</script>

23

```

24

25

## Core Imports

26

27

ES Module:

28

29

```javascript

30

import remarkPresetLintRecommended from 'remark-preset-lint-recommended';

31

```

32

33

CommonJS:

34

35

```javascript

36

const remarkPresetLintRecommended = require('remark-preset-lint-recommended');

37

```

38

39

## Basic Usage

40

41

```javascript

42

import {read} from 'to-vfile'

43

import {reporter} from 'vfile-reporter'

44

import {remark} from 'remark'

45

import remarkPresetLintRecommended from 'remark-preset-lint-recommended'

46

47

main()

48

49

async function main() {

50

const file = await remark()

51

.use(remarkPresetLintRecommended)

52

.process(await read('example.md'))

53

54

console.error(reporter(file))

55

}

56

```

57

58

CLI usage:

59

60

```bash

61

remark --use remark-preset-lint-recommended example.md

62

```

63

64

Package.json configuration:

65

66

```json

67

{

68

"remarkConfig": {

69

"plugins": [

70

"remark-preset-lint-recommended"

71

]

72

}

73

}

74

```

75

76

## Capabilities

77

78

### Preset Configuration

79

80

The main export is a unified preset that provides a comprehensive linting configuration.

81

82

```javascript { .api }

83

const remarkPresetLintRecommended: Preset;

84

```

85

86

The preset contains a curated collection of 15 remark-lint rules organized into three categories:

87

88

**Unix Compatibility:**

89

- `remark-lint-final-newline` - Ensures files end with a newline

90

91

**Consistent Rendering:**

92

- `remark-lint-list-item-bullet-indent` - Ensures consistent list item bullet indentation

93

- `remark-lint-list-item-indent` - Enforces tab-size indentation for list items

94

- `remark-lint-no-blockquote-without-marker` - Requires blockquote markers

95

- `remark-lint-no-literal-urls` - Prevents literal URLs

96

- `remark-lint-ordered-list-marker-style` - Uses '.' style for ordered lists

97

98

**Mistake Prevention:**

99

- `remark-lint-hard-break-spaces` - Manages hard break spaces

100

- `remark-lint-no-duplicate-definitions` - Prevents duplicate definitions

101

- `remark-lint-no-heading-content-indent` - Prevents heading content indentation

102

- `remark-lint-no-inline-padding` - Prevents inline padding

103

- `remark-lint-no-shortcut-reference-image` - Prevents shortcut reference images

104

- `remark-lint-no-shortcut-reference-link` - Prevents shortcut reference links

105

- `remark-lint-no-undefined-references` - Prevents undefined references

106

- `remark-lint-no-unused-definitions` - Prevents unused definitions

107

108

### Preset Interface

109

110

The preset follows the unified Preset interface:

111

112

```javascript { .api }

113

interface Preset {

114

plugins?: PluggableList;

115

settings?: Record<string, unknown>;

116

}

117

118

type PluggableList = Array<Pluggable>;

119

120

type Pluggable = Plugin | PluginTuple | Preset;

121

```

122

123

### Rule Configuration

124

125

Two rules are configured with specific settings:

126

127

```javascript { .api }

128

// List item indentation uses tab-size

129

[remarkLintListItemIndent, 'tab-size']

130

131

// Ordered list markers use period style

132

[remarkLintOrderedListMarkerStyle, '.']

133

```

134

135

All other rules use their default configurations.

136

137

## Types

138

139

The preset is compatible with the unified ecosystem types:

140

141

```typescript { .api }

142

// From unified

143

interface Preset {

144

plugins?: PluggableList;

145

settings?: Record<string, unknown>;

146

}

147

148

type PluggableList = Array<Pluggable>;

149

150

type Pluggable = Plugin | PluginTuple | Preset;

151

152

type Plugin = (this: Processor, ...args: any[]) => Transformer | void;

153

154

type PluginTuple = [Plugin, ...any[]];

155

156

interface Transformer {

157

(tree: Node, file: VFile): Promise<Node | null | undefined> | Node | null | undefined;

158

}

159

160

// From @types/mdast

161

type Node = import('@types/mdast').Node;

162

163

// From vfile

164

interface VFile {

165

readonly path?: string;

166

readonly basename?: string;

167

readonly stem?: string;

168

readonly extname?: string;

169

readonly dirname?: string;

170

readonly history: string[];

171

readonly messages: VFileMessage[];

172

data: {[key: string]: unknown};

173

value: string | Uint8Array;

174

}

175

```

176

177

## Usage Patterns

178

179

### Basic Integration

180

181

```javascript

182

import remarkPresetLintRecommended from 'remark-preset-lint-recommended';

183

import {unified} from 'unified';

184

import remarkParse from 'remark-parse';

185

186

const processor = unified()

187

.use(remarkParse)

188

.use(remarkPresetLintRecommended);

189

```

190

191

### With Additional Configuration

192

193

```javascript

194

import remarkPresetLintRecommended from 'remark-preset-lint-recommended';

195

import {unified} from 'unified';

196

import remarkParse from 'remark-parse';

197

import remarkStringify from 'remark-stringify';

198

199

const processor = unified()

200

.use(remarkParse)

201

.use(remarkPresetLintRecommended)

202

.use(remarkStringify, {

203

bullet: '*',

204

emphasis: '*',

205

fences: true

206

});

207

```

208

209

### Reconfiguring Rules

210

211

Rules can be reconfigured after applying the preset:

212

213

```javascript

214

import remarkPresetLintRecommended from 'remark-preset-lint-recommended';

215

import remarkLintOrderedListMarkerStyle from 'remark-lint-ordered-list-marker-style';

216

import {unified} from 'unified';

217

218

const processor = unified()

219

.use(remarkPresetLintRecommended)

220

// Override the ordered list marker style

221

.use(remarkLintOrderedListMarkerStyle, ')');

222

```

223

224

## Compatibility

225

226

- **Node.js**: 12.20+, 14.14+, 16.0+

227

- **Environment**: ES Module only

228

- **unified**: ^10.0.0

229

- **remark-lint**: ^9.0.0