Comments (7)
I see. It's a bit painful in practice though, because any plugin that creates nodes will itself have to include remark-parse and remark-github, which breaks the single responsibility principle. Could a plugin perhaps use this.Parser somehow?
Yeah I see that. A similar example is remark-usage
, which parses comments in an example.js
file, parses them as Markdown, and embeds them in the processed file.
Previously, we used this.Parser
for that, indeed. However there are cases where that doesn’t work:
this.Parser
could be an HTML parser (fromrehype-parse
ifrehype-remark
was also used)this.Parser
can be configured to support extensions (math? mdx? etc) that you don’t support
An alternative example is that you write a module M that uses Babel to parse JS. Someone uses that in their project P. Do you pick up on the config that the user has in their project P? Maybe they use JSX, but you don’t support that.
from remark-github.
What kind of syntax / nodes are you talking about?
from remark-github.
Any new node (or an entirely new tree) that contains text like #23
and the other supported references.
from remark-github.
Right! Is that text coming from git commit messages? Could text also include other Markdown syntax? Such as: Fix `inlineCode` handling
?
from remark-github.
Is that text coming from git commit messages?
Not always. I also detect merge commits that have the message "Merge pull request #n" and add that PR number to commits. I chose not to insert links to GitHub myself, because I figured remark-github
could do that.
Could text also include other Markdown syntax
That hadn't crossed my mind! But parsing that (not sure I want to) would be a separate feature, not one that's related to remark-github
.
from remark-github.
remark-github
does two things: it parses stuff, and it transforms stuff.
The parsing is for things like #2
, the transforms are for links.
(such as if you link to a commit, https://github.com/remarkjs/remark-github/commit/3cf0e0b4a4046c5cba1f67a55b53c5e762751816
, it’ll change the link content: 3cf0e0b). It’s a mix and it’ll be separated better in the future with micromark.
That hadn't crossed my mind! But parsing that (not sure I want to) would be a separate feature, not one that's related to remark-github.
Where I’m going with the above questions is that see them as exactly the same thing.
I see the parsing extensions in this package as syntax extensions, they’re a separate parsing step.
If someone were to inject *foo*
in the syntax tree, it would output *foo* instead of foo, doing that with the syntax supported in this plugin is handled the same.
We can’t keep on parsing again and again on every change.
If you want to inject syntax into the tree, you need to create nodes yourself. E.g., with unified.use(remarkParse).use(remarkGitHub)
!
from remark-github.
I see the parsing extensions in this package as syntax extensions
I see. It's a bit painful in practice though, because any plugin that creates nodes will itself have to include remark-parse
and remark-github
, which breaks the single responsibility principle. Could a plugin perhaps use this.Parser
somehow?
This is now more of a support request than bug report, so it's OK to close, I'll figure something out!
from remark-github.
Related Issues (20)
- Bug: If link # changes then the link does not update HOT 2
- Failed on latest remark HOT 3
- Regex is incorrect (does not accurately parse GitHub usernames) HOT 3
- Support repositories including dots HOT 1
- GitHub no longer links @mention and @mentions
- Mistakes email address for git commit and author HOT 4
- Deny `defaced`, `acceded`, `effaced`
- remark-github treats '.YYYYMMDD' as a commit ID. HOT 8
- Support custom GitHub url HOT 5
- Changes indentation within lists HOT 2
- Add option to customize generated <a> tags HOT 2
- Add option to use disable @mentions linking HOT 6
- Change request: Make commit hash regex more strict HOT 6
- [Feature request] Allow transform links only HOT 9
- Resolving `package.json` should rely on the vfile cwd, not process HOT 3
- Tests are broken due to changes in `mdast-util-find-and-replace` HOT 1
- Missing or invalid `repository` field in `options` HOT 4
- [Feature Request] Support repo url. HOT 5
- Prevent autolinking for specific text? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remark-github.