![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
markdown-magic
Advanced tools
Automatically keep markdown files up to date from source code or via external sources.
This readme is generated with markdown-magic
view the raw file to see how.
npm install markdown-magic --save-dev
import markdownMagic from 'markdown-magic'
import path from 'path'
const markdownPath = path.join(__dirname, 'README.md')
markdownMagic(markdownPath)
lolloll
markdownMagic(filename, config, callback)
// Configuration and callback are optional params
matchWord
- string - (optional) Comment pattern to look for & replace inner contents. Default AUTO-GENERATED-CONTENT
commands
- object - (optional) Custom commands to transform block contents, see configuration options below.
outputPath
- string - (optional) Change output path of new content. Default behavior is replacing the original file
Markdown Magic comes with a couple of built in transforms for you to use or you can extend it with your own transforms. See 'Custom Transforms' below.
CODE
Get code from file or URL and put in markdown
Options:
src
: The relative path to the code to pull in, or the URL
where the raw code livessyntax
(optional): Syntax will be inferred by fileType if not specifiedExample:
<-- MATCHWORD:START (CODE:src=./relative/path/to/code.js) -->
This content will be dynamically replaced with code from the file
<-- MATCHWORD:END -->
REMOTE
Get any remote Data and put in markdown
Options:
url
: The URL of the remote content to pull inExample:
<-- MATCHWORD:START (REMOTE:url=http://url-to-raw-md.md) -->
This content will be dynamically replace from the remote url
<-- MATCHWORD:END -->
Markdown Magic is extendable via plugins.
Plugins allow developers to add new transforms, use different rendering engines or any other logic you might want in config.commands
.
This code is used to generate this markdown file:
const fs = require('fs')
const path = require('path')
const dox = require('dox')
const execSync = require('child_process').execSync
// require('markdown-steriods') lib
const markdownMagic = require('../index')
const config = {
commands: {
/* Update the content in comment in .md matching
AUTO-GENERATED-CONTENT (customTransform:optionOne=hi&optionOne=DUDE)
*/
customTransform(content, options) {
console.log('original innerContent', content)
console.log(options) // { optionOne: hi, optionOne: DUDE}
return `This will replace all the contents of inside the comment ${options.optionOne}`
},
/* Update the content in comment in .md matching
AUTO-GENERATED-CONTENT (RENDERDOCS:path=../file.js)
*/
RENDERDOCS(content, options) {
const filePath = path.join(__dirname, options.path)
const contents = fs.readFileSync(filePath, 'utf8')
const docBlocs = dox.parseComments(contents, { raw: true, skipSingleStar: true })
let updatedContent = ''
docBlocs.forEach((data) => {
updatedContent += `${data.description.full}\n\n`
})
return updatedContent.replace(/^\s+|\s+$/g, '')
},
pluginExample: require('./plugin-example')({ addNewLine: true })
}
}
/* This example callback automatically updates Readme.md and commits the changes */
const callback = function autoGitCommit(updatedContent, outputConfig) {
const mdPath = outputConfig.outputPath
const gitAdd = execSync(`git add ${mdPath}`, {}, (error) => {
if (error) console.warn(error)
console.log('git add complete')
const msg = `${mdPath} automatically updated by markdown-magic`
const gitCommitCommand = `git commit -m '${msg}' --no-verify`
execSync(gitCommitCommand, {}, (err) => {
if (err) console.warn(err)
console.log('git commit automatically ran. Push up your changes!')
})
})
}
const markdownPath = path.join(__dirname, '..', 'README.md')
markdownMagic(markdownPath, config, callback)
View the raw source of this README.md
file to see the comment block and see how the customTransform
function in examples/generate-docs.js
works
This will replace all the contents of inside the comment DUDE
what
This was inspired by Kent C Dodds and jfmengels's all contributors cli project.
FAQs
Automatically update markdown files with content from external sources
The npm package markdown-magic receives a total of 0 weekly downloads. As such, markdown-magic popularity was classified as not popular.
We found that markdown-magic demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.