Skip to content

Commit aa50d9f

Browse files
lukasgeiterEugeneHlushko
authored andcommitted
fix(docs): Escape backslashes in mdx files (#2917)
1 parent 9d28450 commit aa50d9f

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

src/content/api/node.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ contributors:
77
- byzyk
88
- wizardofhogwarts
99
- EugeneHlushko
10+
- lukasgeiter
1011
---
1112

1213
webpack provides a Node.js API which can be used directly in Node.js runtime.
@@ -274,7 +275,7 @@ webpack([
274275
{ entry: './index1.js', output: { filename: 'bundle1.js' } },
275276
{ entry: './index2.js', output: { filename: 'bundle2.js' } }
276277
], (err, [stats](#stats-object)) => {
277-
process.stdout.write(stats.toString() + '\n');
278+
process.stdout.write(stats.toString() + '\\n');
278279
})
279280
```
280281

src/content/concepts/loaders.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ contributors:
1313
- debs-obrien
1414
- EugeneHlushko
1515
- wizardofhogwarts
16+
- lukasgeiter
1617
---
1718

1819
Loaders are transformations that are applied on the source code of a module. They allow you to pre-process files as you `import` or “load” them. Thus, loaders are kind of like “tasks” in other build tools and provide a powerful way to handle front-end build steps. Loaders can transform files from a different language (like TypeScript) to JavaScript or inline images as data URLs. Loaders even allow you to do things like `import` CSS files directly from your JavaScript modules!
@@ -35,8 +36,8 @@ __webpack.config.js__
3536
module.exports = {
3637
module: {
3738
rules: [
38-
{ test: /\.css$/, use: 'css-loader' },
39-
{ test: /\.ts$/, use: 'ts-loader' }
39+
{ test: /\\.css$/, use: 'css-loader' },
40+
{ test: /\\.ts$/, use: 'ts-loader' }
4041
]
4142
}
4243
};
@@ -64,7 +65,7 @@ module.exports = {
6465
module: {
6566
rules: [
6667
{
67-
test: /\.css$/,
68+
test: /\\.css$/,
6869
use: [
6970
// [style-loader](/loaders/style-loader)
7071
{ loader: 'style-loader' },

src/content/configuration/index.mdx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ contributors:
1313
- sterlingvix
1414
- jeremenichelli
1515
- dasarianudeep
16+
- lukasgeiter
1617
---
1718

1819
Out of the box, webpack won't require you to use a configuration file. However, it will assume the entry point of your project is `src/index` and will output the result in `dist/main.js` minified and optimized for production.
@@ -144,14 +145,14 @@ module.exports = {
144145
/* Expert output configuration (on own risk) */
145146
</default>
146147
devtoolLineToLine: {
147-
test: /\.jsx$/
148+
test: /\\.jsx$/
148149
},
149150
// use a simple 1:1 mapped SourceMaps for these modules (faster)
150151
hotUpdateMainFilename: "[hash].hot-update.json", // string
151152
// filename template for HMR manifest
152153
hotUpdateChunkFilename: "[id].[hash].hot-update.js", // string
153154
// filename template for HMR chunks
154-
sourcePrefix: "\t", // string
155+
sourcePrefix: "\\t", // string
155156
// prefix module sources in bundle for better readablitity
156157
</expert>
157158
},
@@ -160,7 +161,7 @@ module.exports = {
160161
rules: [
161162
// rules for modules (configure loaders, parser options, etc.)
162163
{
163-
test: /\.jsx?$/,
164+
test: /\\.jsx?$/,
164165
include: [
165166
path.resolve(__dirname, "app")
166167
],
@@ -189,7 +190,7 @@ module.exports = {
189190
// options for the loader
190191
},
191192
{
192-
test: /\.html$/,
193+
test: /\\.html$/,
193194
use: [
194195
// apply multiple loaders and options
195196
"htmllint-loader",
@@ -218,15 +219,15 @@ module.exports = {
218219
/* Advanced module configuration (click to show) */
219220
</default>
220221
noParse: [
221-
/special-library\.js$/
222+
/special-library\\.js$/
222223
],
223224
// do not parse this module
224225
unknownContextRequest: ".",
225226
unknownContextRecursive: true,
226-
unknownContextRegExp: /^\.\/.*$/,
227+
unknownContextRegExp: /^\\.\\/.*$/,
227228
unknownContextCritical: true,
228229
exprContextRequest: ".",
229-
exprContextRegExp: /^\.\/.*$/,
230+
exprContextRegExp: /^\\.\\/.*$/,
230231
exprContextRecursive: true,
231232
exprContextCritical: true,
232233
wrappedContextRegExp: /.*/,
@@ -355,7 +356,7 @@ module.exports = {
355356
externals: ["react", /^@angular/],
356357
</default>
357358
externals: "react", // string (exact match)
358-
externals: /^[a-z\-]+($|\/)/, // Regex
359+
externals: /^[a-z\\-]+($|\\/)/, // Regex
359360
externals: { // object
360361
angular: "this angular", // this["angular"]
361362
react: { // UMD

src/content/configuration/module.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ contributors:
1313
- nerdkid93
1414
- EugeneHlushko
1515
- superburrito
16+
- lukasgeiter
1617
---
1718

1819
These options determine how the [different types of modules](/concepts/modules) within a project will be treated.
@@ -183,7 +184,7 @@ module.exports = {
183184
module: {
184185
rules: [
185186
{
186-
test: /\.css$/,
187+
test: /\\.css$/,
187188
oneOf: [
188189
{
189190
resourceQuery: /inline/, // foo.css?inline
@@ -264,7 +265,7 @@ module.exports = {
264265
module: {
265266
rules: [
266267
{
267-
test: /\.css$/,
268+
test: /\\.css$/,
268269
resourceQuery: /inline/,
269270
use: 'url-loader'
270271
}
@@ -308,7 +309,7 @@ module.exports = {
308309
rules: [
309310
//...
310311
{
311-
test: /\.json$/,
312+
test: /\\.json$/,
312313
type: 'javascript/auto',
313314
loader: 'custom-json-loader'
314315
}
@@ -433,7 +434,7 @@ module.exports = {
433434
module: {
434435
rules: [
435436
{
436-
test: /\.css$/,
437+
test: /\\.css$/,
437438
include: [
438439
path.resolve(__dirname, 'app/styles'),
439440
path.resolve(__dirname, 'vendor/styles')
@@ -558,6 +559,6 @@ T> You can use the `ContextReplacementPlugin` to modify these values for individ
558559
A few use cases:
559560

560561
- Warn for dynamic dependencies: `wrappedContextCritical: true`.
561-
- `require(expr)` should include the whole directory: `exprContextRegExp: /^\.\//`
562+
- `require(expr)` should include the whole directory: `exprContextRegExp: /^\\.\\//`
562563
- `require('./templates/' + expr)` should not include subdirectories by default: `wrappedContextRecursive: false`
563564
- `strictExportPresence` makes missing exports an error instead of warning

0 commit comments

Comments
 (0)