Add @it-service-npm/remark-include to list of plugins#1478
Add @it-service-npm/remark-include to list of plugins#1478wooorm merged 1 commit intoremarkjs:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1478 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 138 138
=========================================
Hits 138 138 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks! I like the idea of your plugin. I have some feedback:
|
|
Thank You, @remcohaszing, for Your feedback!
I use updated: fixed: IT-Service-NPM/remark-include@08f50db prettier used as ESLint plugin. |
|
This is my paranoia... |
|
|
Yes. This plugin processes the included markdown Abstract Syntax Tree (AST) using a configured Processor ( |
|
|
fixed. |
fixed: IT-Service-NPM/remark-include@e99217e
fixed. |
|
fixed: IT-Service-NPM/remark-include@d994461 There are two plugins:
And this package provides two plugins presets:
|
|
v4.2.0 released. @remcohaszing, thank You for Your collaboration! |
|
@remcohaszing, thank you again for your cooperation! I would greatly appreciate your feedback on version 4.2.0. I have made efforts to address all your comments. |
fixed: IT-Service-NPM/remark-include@08f50db prettier used as ESLint plugin. |
|
The code doesn’t appear to be formatted with Prettier 🤔 But that’s more of a tip. I strongly recommend using a formatter, but IMO it’s not a requirement to be added to this list. I see some type casting. I see you use this: if (['image', 'link', 'definition'].includes(_node.type)) {
fixIncludedResourcesURL(_node as Resource, mainFile, includedFile);
}I know that this pattern of if (_node.type === 'image' || _node.type === 'link' || _node.type === 'definition') {
fixIncludedResourcesURL(_node, mainFile, includedFile);
}Likewise I think you can get rid of the Anyway, I appreciate how you took the feedback. I think this is good enough to be added to the list. |
|
@remcohaszing , thank You!
I use Prettier, and format source files with prettier plugin for ESLint. But I use another rules set, may be... import { defineConfig } from 'eslint/config';
import { ESLint } from 'eslint';
import ESLintJs from '@eslint/js';
import ESLintPluginN from 'eslint-plugin-n';
import ESLintPluginTSDoc from 'eslint-plugin-tsdoc';
import ESLintPluginTypescript from 'typescript-eslint';
import ESLintPluginVitest from '@vitest/eslint-plugin';
import ESLintPluginPrettier from 'eslint-plugin-prettier';
import ESLintPluginUnicorn from 'eslint-plugin-unicorn';
import ESLintConfigPrettier from 'eslint-config-prettier';
import ESLintPluginSonarJs from 'eslint-plugin-sonarjs';
export default defineConfig([
{
extends: [
ESLintPluginSonarJs.configs.recommended,
ESLintJs.configs.recommended,
// ESLintPluginTypescript.configs.recommendedTypeChecked,
...ESLintPluginTypescript.configs.strictTypeChecked,
...ESLintPluginTypescript.configs.stylisticTypeChecked,
ESLintPluginUnicorn.configs.recommended,
ESLintConfigPrettier
],
plugins: {
'n': ESLintPluginN,
'prettier': ESLintPluginPrettier,
'unicorn': ESLintPluginUnicorn
},
rules: {
'array-bracket-spacing': ['error', 'never'],
'block-scoped-var': 'error',
'brace-style': ['error', '1tbs'],
'camelcase': 'warn',
'computed-property-spacing': ['error', 'never'],
'curly': 'error',
'eol-last': 'error',
'eqeqeq': ['error', 'smart'],
'max-depth': ['warn', 3],
'max-len': ['warn', 80],
'max-statements': ['warn', 15],
'new-cap': 'warn',
'no-extend-native': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-trailing-spaces': 'error',
'no-unused-vars': 'warn',
'no-use-before-define': ['error', 'nofunc'],
'object-curly-spacing': ['error', 'always'],
'quotes': ['error', 'single', 'avoid-escape'],
'semi': ['error', 'always'],
'keyword-spacing': ['error', { 'before': true, 'after': true }],
'space-unary-ops': 'error',
'unicorn/no-typeof-undefined': 'off',
'unicorn/no-this-assignment': 'off',
'@typescript-eslint/no-this-alias': 'off',
'sonarjs/no-alphabetical-sort': 'off'
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
}
},
},
{
ignores: [
'**/*.js',
'**/*.mjs',
'node_modules',
'dist',
'coverage'
]
},
{
files: [
'src/**/*.ts'
],
plugins: {
n: ESLintPluginN,
tsdoc: (ESLintPluginTSDoc as ESLint.Plugin),
prettier: ESLintPluginPrettier,
unicorn: ESLintPluginUnicorn
},
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': ['error', {
'argsIgnorePattern': '^_|^(resolve|reject|err)$'
}],
'n/no-missing-import': ['error', {
'ignoreTypeImport': true
}]
},
},
{
files: ['test/**/*.test.ts'],
plugins: {
n: ESLintPluginN,
prettier: ESLintPluginPrettier,
vitest: ESLintPluginVitest
},
rules: {
// ...ESLintPluginVitest.configs.all.rules,
...ESLintPluginVitest.configs.recommended.rules,
'max-statements': 'off'
},
settings: {
vitest: {
typecheck: true
}
},
languageOptions: {
globals: {
...ESLintPluginVitest.environments.env.globals,
},
}
},
]); |
|
This comment has been minimized.
This comment has been minimized.
|
Thanks! :) |
Thank You! |
Initial checklist
Description of changes
Updated plugins list.
Added a new plugin, @it-service-npm/remark-include.
With this plugin, you can use
::include{file=./included.md}statements to compose markdown files together.This plugin is a modern version of remark-import plugin and remark-include plugin, written in Typescript, and compatible with Remark v15.
Relative images and links in the included files will have their paths rewritten to be relative the original document rather than the included file.
An included markdown file will “inherit” the heading levels. If the
::include{file=./included.md}statement happens under Heading 2, for example, any heading 1 in the included file will be “translated” to have header level 3.