-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for embedding fragments with <!-- [fragment] -->
syntax
#830
Added support for embedding fragments with <!-- [fragment] -->
syntax
#830
Conversation
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
cc @timaschew @trusktr can you review this ? |
This can come in really handy.. @tannerntannern could you please fix the conflight with master and then lets cross fingers for this getting merged. To verify that this works you should also add some tests for this 💯 💘 |
I like this syntax better than the existing syntax options. 👍 @tannerntannern Mind resolving the conflict? |
…d-syntax # Conflicts: # src/core/render/embed.js
Thanks @arelstone and @trusktr. I resolved the conflicts but I've been struggling to add proper tests, not knowing the repository well. I've been trying to get something working in describe('embed', function() {
it('/// [syntax]', async function() {
const { docsify } = await init();
expectSameDom(
docsify.compiler.compile(
'Here is some JS: "[filename](../fixtures/embed/slash-syntax/embed1.js \':include :type=code :fragment=fragment\')"'
),
'<p>Here is some JS: "const foo = \'bar\';"</p>'
);
});
it('### [syntax]', async function() {
// TODO
});
it('<!-- [syntax] -->', async function() {
// TODO
});
}); Any guidance is appreciated. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Summary
Embedding file snippets via
/// [snippet]
is a very powerful feature, but it currently doesn't work well with markdown or HTML snippets. I added a third option,<!-- [snippet] -->
, to deal with this problem and modified the relevant docs.I hate to make things difficult for the reviewers... but I got endless errors trying to build the project on my Windows machine, so I was not able to test or build the project. I did test my regex additions separately though. If someone could independently test this, it would be much appreciated. Here's an example to make it easy:
What kind of change does this PR introduce? (check at least one)
If changing the UI of default theme, please provide the before/after screenshot:
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
fix #xxx[,#xxx]
, where "xxx" is the issue number)You have tested in the following browsers: (Providing a detailed version will be better.)
If adding a new feature, the PR's description includes:
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.
Other information:
lib
directory.