mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 21:47:10 -04:00
Update dependencies.
Thanks to developers of dependencies.
This commit is contained in:
parent
d344c39d49
commit
cfcbf640d6
26 changed files with 1210 additions and 3276 deletions
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -5627,11 +5627,11 @@
|
|||
}
|
||||
},
|
||||
"xss": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/xss/-/xss-1.0.6.tgz",
|
||||
"integrity": "sha512-6Q9TPBeNyoTRxgZFk5Ggaepk/4vUOYdOsIUYvLehcsIZTFjaavbVnsuAkLA5lIFuug5hw8zxcB9tm01gsjph2A==",
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/xss/-/xss-1.0.8.tgz",
|
||||
"integrity": "sha512-3MgPdaXV8rfQ/pNn16Eio6VXYPTkqwa0vc7GkiymmY/DqR1SE/7VPAAVZz1GJsJFrllMYO3RHfEaiUGjab6TNw==",
|
||||
"requires": {
|
||||
"commander": "^2.9.0",
|
||||
"commander": "^2.20.3",
|
||||
"cssfilter": "0.0.10"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -75,6 +75,6 @@
|
|||
"papaparse": "^5.2.0",
|
||||
"qs": "^6.9.4",
|
||||
"source-map-support": "^0.5.19",
|
||||
"xss": "^1.0.6"
|
||||
"xss": "^1.0.8"
|
||||
}
|
||||
}
|
||||
|
|
1
packages/markdown/.gitignore
vendored
1
packages/markdown/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
.build*
|
0
packages/markdown/README.md
Executable file → Normal file
0
packages/markdown/README.md
Executable file → Normal file
|
@ -8,3 +8,4 @@ Having said that, we take the security of Marked very seriously.
|
|||
Please disclose potential security issues by email to the project [committers](https://marked.js.org/#/AUTHORS.md) as well as the [listed owners within NPM](https://docs.npmjs.com/cli/owner).
|
||||
We will provide an initial assessment of security reports within 48 hours and should apply patches within 2 weeks
|
||||
(also, feel free to contribute a fix for the issue).
|
||||
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"extends": "standard",
|
||||
"plugins": [
|
||||
"standard"
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 5,
|
||||
"sourceType": "script"
|
||||
},
|
||||
"rules": {
|
||||
"semi": ["error", "always"],
|
||||
"indent": ["error", 2, {
|
||||
"SwitchCase": 1,
|
||||
"VariableDeclarator": { "var": 2 },
|
||||
"outerIIFEBody": 0
|
||||
}],
|
||||
"operator-linebreak": ["error", "before", { "overrides": { "=": "after" } }],
|
||||
"space-before-function-paren": ["error", "never"],
|
||||
"no-cond-assign": "off",
|
||||
"no-useless-escape": "off",
|
||||
"one-var": "off",
|
||||
"no-control-regex": "off",
|
||||
"no-prototype-builtins": "off",
|
||||
|
||||
"prefer-const": "off",
|
||||
"no-var": "off"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": true,
|
||||
"amd": true
|
||||
}
|
||||
}
|
|
@ -1,269 +0,0 @@
|
|||
# Authors
|
||||
|
||||
Marked takes an encompassing approach to its community. As such, you can think of these as [concentric circles](https://medium.com/the-node-js-collection/healthy-open-source-967fa8be7951), where each group encompasses the following groups.
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" valign="top" style="width:32%">
|
||||
<a href="https://github.com/chjj">
|
||||
<img width="100" height="100" src="https://github.com/chjj.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/chjj">Christopher Jeffrey</a>
|
||||
<div>Original Author</div>
|
||||
<small>Started the fire</small>
|
||||
</td>
|
||||
<td align="center" valign="top" style="width:32%">
|
||||
<a href="https://github.com/joshbruce">
|
||||
<img width="100" height="100" src="https://github.com/joshbruce.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://joshbruce.com">Josh Bruce</a>
|
||||
<div>Publisher</div>
|
||||
<small>Release Wrangler; Humaning Helper; Heckler of Hypertext</small>
|
||||
</td>
|
||||
<td align="center" valign="top" style="width:32%">
|
||||
<a href="https://github.com/styfle">
|
||||
<img width="100" height="100" src="https://github.com/styfle.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://www.ceriously.com">Steven</a>
|
||||
<div>Publisher</div>
|
||||
<small>Release Wrangler; Dr. Docs; Open source, of course; GitHub Guru; Humaning Helper</small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<a href="https://github.com/davisjam">
|
||||
<img width="100" height="100" src="https://github.com/davisjam.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/davisjam">Jamie Davis</a>
|
||||
<div>Committer</div>
|
||||
<small>Seeker of Security</small>
|
||||
</td>
|
||||
<td align="center" valign="top">
|
||||
<a href="https://github.com/UziTech">
|
||||
<img width="100" height="100" src="https://github.com/UziTech.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://tony.brix.ninja">Tony Brix</a>
|
||||
<div>Publisher</div>
|
||||
<small>Release Wrangler; Titan of the test harness; Dr. DevOps</small>
|
||||
</td>
|
||||
<td align="center" valign="top">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<a href="https://github.com/intcreator">
|
||||
<img width="100" height="100" src="https://github.com/intcreator.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/intcreator">Brandon der Blätter</a>
|
||||
<div>Contributor</div>
|
||||
<small>Curious Contributor</small>
|
||||
</td>
|
||||
<td align="center" valign="top">
|
||||
<a href="https://github.com/carlosvalle">
|
||||
<img width="100" height="100" src="https://github.com/carlosvalle.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/carlosvalle">Carlos Valle</a>
|
||||
<div>Contributor</div>
|
||||
<small>Maker of the Marked mark from 2018 to present</small>
|
||||
</td>
|
||||
<td align="center" width="20%" valign="top">
|
||||
<a href="https://github.com/Feder1co5oave">
|
||||
<img width="100" height="100" src="https://github.com/Feder1co5oave.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/Feder1co5oave">Federico Soave</a>
|
||||
<div>Contributor</div>
|
||||
<small>Regent of the Regex; Master of Marked</small>
|
||||
</td>
|
||||
<td align="center" valign="top">
|
||||
<a href="https://github.com/karenyavine">
|
||||
<img width="100" height="100" src="https://github.com/karenyavine.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/karenyavine">Karen Yavine</a>
|
||||
<div>Contributor</div>
|
||||
<small>Snyk's Security Saint</small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<a href="https://github.com/KostyaTretyak">
|
||||
<img width="100" height="100" src="https://github.com/KostyaTretyak.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/KostyaTretyak">Костя Третяк</a>
|
||||
<div>Contributor</div>
|
||||
<small></small>
|
||||
</td>
|
||||
<td align="center" width="20%" valign="top">
|
||||
<a href="https://github.com/tomtheisen">
|
||||
<img width="100" height="100" src="https://github.com/tomtheisen.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/tomtheisen">Tom Theisen</a>
|
||||
<div>Contributor</div>
|
||||
<small>Defibrillator</small>
|
||||
</td>
|
||||
<td align="center" width="20%" valign="top">
|
||||
<a href="https://github.com/mccraveiro">
|
||||
<img width="100" height="100" src="https://github.com/mccraveiro.png?s=150">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://github.com/mccraveiro">Mateus Craveiro</a>
|
||||
<div>Contributor</div>
|
||||
<small>Defibrillator</small>
|
||||
</td>
|
||||
<td align="center" width="20%" valign="top">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## Publishers
|
||||
|
||||
Publishers are admins who also have the responsibility, privilege, and burden of publishing the new releases to NPM and performing outreach and external stakeholder communications. Further, when things go pear-shaped, they're the ones taking most of the heat. Finally, when things go well, they're the primary ones praising the contributors who made it possible.
|
||||
|
||||
(In other words, while Admins are focused primarily on the internal workings of the project, Publishers are focused on internal *and* external concerns.)
|
||||
|
||||
**Should not exceed 2:** Having more people with the authority to publish a release can quickly turn into a consensus seeking nightmare (design by committee). Having only one is preferred (Directly Responsible Individual); however, given the nature of the project and its history, having an immediate fallback, and a potential deep fallback (Original author) is probably a good idea.
|
||||
|
||||
[Details on badges](#badges)
|
||||
|
||||
## Admins
|
||||
|
||||
Admins are committers who also have the responsibility, privilege, and burden of selecting committers and making sure the project itself runs smoothly, which includes community maintenance, governance, dispute resolution, and so on. (Letting the contributors easily enter into, and work within, the project to begin contributing, with as little friction as possible.)
|
||||
|
||||
**Should not exceed 3:** When there are too many people with the ability to resolve disputes, the dispute itself can quickly turn into a dispute amongst the admins themselves; therefore, we want this group to be small enough to commit to action and large enough to not put too much burden on one person. (Should ensure faster resolution and responsiveness.)
|
||||
|
||||
To be listed: Admins are usually selected from the pool of committers (or they volunteer, using the same process) who demonstrate good understanding of the marked culture, operations, and do their best to help new contributors get up to speed on how to contribute effectively to the project.
|
||||
|
||||
To be removed: You can remove yourself through the [GitHub UI](https://help.github.com/articles/removing-yourself-from-a-collaborator-s-repository/).
|
||||
|
||||
[Details on badges](#badges)
|
||||
|
||||
## Committers
|
||||
|
||||
Committers are contributors who also have the responsibility, privilege, some might even say burden of being able to review and merge contributions (just usually not their own).
|
||||
|
||||
A note on "decision making authority". This is related to submitting PRs and the [advice process](http://www.reinventingorganizationswiki.com/Decision_Making). The person marked as having decision making authority over a certain area should be sought for advice in that area before committing to a course of action.
|
||||
|
||||
**Should not exceed 5:** For larger PRs affecting more of the codebase and, most likely, review by more people, we try to keep this pool small and responsive and let those with decision making authority have final say without negative repercussions from the other committers.
|
||||
|
||||
To be listed: Committers are usually selected (or they volunteer, using the same process) from contributors who enter the discussions regarding the future direction of Marked (maybe even doing informal reviews of contributions despite not being able to merge them yourself).
|
||||
|
||||
To be removed: You can remove yourself through the [GitHub UI](https://help.github.com/articles/removing-yourself-from-a-collaborator-s-repository/).
|
||||
|
||||
A note on volunteering:
|
||||
|
||||
1. Please do not volunteer unless you believe you can demonstrate to your peers you can do the work required.
|
||||
2. Please do not overcommit yourself; we count on those committed to the project to be responsive. Really consider, with all you have going on, whether you able to really commit to it.
|
||||
3. Don't let the previous frighten you away, it can always be changed later by you or your peers.
|
||||
|
||||
[Details on badges](#badges)
|
||||
|
||||
## Contributors
|
||||
|
||||
Contributors are users who submit a [PR](https://github.com/markedjs/marked/pulls), [Issue](https://github.com/markedjs/marked/issues), or collaborate in making Marked a better product and experience for all the users.
|
||||
|
||||
To be listed: make a contribution and, if it has significant impact, the committers may be able to add you here.
|
||||
|
||||
To be removed: please let us know or submit a PR.
|
||||
|
||||
[Details on badges](#badges)
|
||||
|
||||
## Users
|
||||
|
||||
Users are anyone using Marked in some fashion, without them, there's no reason for us to exist.
|
||||
|
||||
|Individual or Organization |Website |Project |Submitted by |
|
||||
|:--------------------------|:-----------------------|:------------------------------------|:---------------------------------------------------|
|
||||
|MarkedJS |https://marked.js.org |https://github.com/markedjs/marked |The marked committers |
|
||||
|
||||
To be listed: All fields are optional. Contact any of the committers or, more timely, submit a pull request with the following (using the first row as an example):
|
||||
|
||||
- **Individual or Organization:** The name you would like associated with the record.
|
||||
- **Website:** A URL to a standalone website for the project.
|
||||
- **Project:** A URL for the repository of the project using marked.
|
||||
- **Submitted by:** The name and optional honorifics for the person adding the listing.
|
||||
|
||||
To be removed: Same as above. Only instead of requesting addition request deletion or delete the row yourself.
|
||||
|
||||
<h2 id="badges">Badges</h2>
|
||||
|
||||
Badges? You don't *need* no stinkin' badges.
|
||||
|
||||
Movie references aside. (It was either that or, "Let's play a game", but that would have been creepy…that's why it will most likely come later.)
|
||||
|
||||
Badges? If you *want* 'em, we got 'em, and here's how you get 'em (and…dramatic pause…why not two dramatic pauses for emphasis?… how they can be taken away).
|
||||
|
||||
- [ ] Add the appropriate badge to the desired contributor in the desired column of this page, even if they're not listed here yet.
|
||||
- [ ] Submit a PR (we're big on PRs around here, if you haven't noticed, help us help you).
|
||||
- [ ] Follow the instructions for submitting a badge PR. (There are more details to find within. Come on. Everybody likes surprises, right? No? Actually, we just try to put documentation where it belongs, closer to the code and part of the sequence of events.)
|
||||
|
||||
### Badges at play:
|
||||
|
||||
<dl>
|
||||
<dt>Curious Contributor</dt>
|
||||
<dd>A contributor with less than one year on this page who is actively engaged in submitting PRs, Issues, making recommendations, sharing thoughts…without being too annoying about it (let's be clear, submitting 100 Issues recommending the Marked Committers send everyone candy is trying for the badge, not honestly earning it).</dd>
|
||||
<dt>Dr. DevOps</dt>
|
||||
<dd>
|
||||
<p>Someone who understands and contributes to improving the developer experience and flow of Marked into the world.</p>
|
||||
<blockquote>
|
||||
"The main characteristic of the DevOps movement is to strongly advocate automation and monitoring at all steps of software construction, from integration, testing, releasing to deployment and infrastructure management. DevOps aims at shorter development cycles, increased deployment frequency, more dependable releases, in close alignment with business objectives." ~ <a href="https://www.wikipedia.org/wiki/DevOps">Wikipedia</a>
|
||||
</blockquote>
|
||||
</dd>
|
||||
<dt>Dr. Docs</dt>
|
||||
<dd>Someone who has contributed a great deal to the creation and maintenance of the non-code areas of marked.</dd>
|
||||
<dt>Eye for the CLI</dt>
|
||||
<dd>At this point? Pretty much anyone who can update that `man` file to the current Marked version without regression in the CLI tool itself.</dd>
|
||||
<dt>GitHub Guru</dt>
|
||||
<dd>Someone who always seems to be able to tell you easier ways to do things with GitHub.</dd>
|
||||
<dt>Humaning Helper</dt>
|
||||
<dd>Someone who goes out of their way to help contributors feel welcomed and valued. Further, someone who takes the extra steps(s) necessary to help new contributors get up to speed. Finally, they maintain composure even in times of disagreement and dispute resolution.</dd>
|
||||
<dt>Heckler of Hypertext</dt>
|
||||
<dd>Someone who demonstrates an esoteric level of knowledge when it comes to HTML. In other words, someone who says things like, "Did you know most Markdown flavors don't have a way to render a description list (`dl`)? All the more reason Markdown `!==` HTML."</dd>
|
||||
<dt>Markdown Maestro</dt>
|
||||
<dd>You know that person who knows about way too many different flavors of Markdown? The one who maybe seems a little too obsessed with the possibilities of Markdown beyond HTML? Come on. You know who they are. Or, at least you could, if you give them this badge.</dd>
|
||||
<dt>Master of Marked</dt>
|
||||
<dd>Someone who demonstrates they know the ins and outs of the codebase for Marked.</dd>
|
||||
<dt>Open source, of course</dt>
|
||||
<dd>Someone who advocates for and has a proven understanding of how to operate within open source communities.</dd>
|
||||
<dt>Regent of the Regex</dt>
|
||||
<dd><p>Can you demonstrate you understand the following without Google and Stackoverflow?</p>
|
||||
<p><code>/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/</code></p>
|
||||
<p>Because this author can't yet. That's who gets these.</p>
|
||||
</dd>
|
||||
<dt>Seeker of Security</dt>
|
||||
<dd>Someone who has demonstrated a high degree of expertise or authority when it comes to software security.</dd>
|
||||
<dt>Titan of the Test Harness</dt>
|
||||
<dd>Someone who demonstrates high-levels of understanding regarding Marked's test harness.</dd>
|
||||
<dt>Totally Tron</dt>
|
||||
<dd>Someone who demonstrates they are willing and able to "fight for the users", both developers dependent on marked to do their jobs as well as end-users interacting with the output (particularly in the realm of those with the disabilities).</dd>
|
||||
</dl>
|
||||
|
||||
### Special badges that come with the job:
|
||||
|
||||
<dl>
|
||||
<dt>Defibrillator</dt>
|
||||
<dd>A contributor who stepped up to help bring Marked back to life by contributing solutions to help Marked pass when compared against the CommonMark and GitHub Flavored Markdown specifications.</dd>
|
||||
<dt>Maker of the Marked mark</dt>
|
||||
<dd>This badge is given to the person or organization credited with creating the logo (or logotype) used in Marked communications for a given period of time. **Maker of the Marked mark from 2017 to present**, for example.</dd>
|
||||
<dt>Release Wrangler</dt>
|
||||
<dd>This is a badge given to all Publishers.</dd>
|
||||
<dt>Snyk's Security Saint</dt>
|
||||
<dd>This is a badge given to whomever primarily reaches out from Snyk to let us know about security issues.</dd>
|
||||
</dl>
|
|
@ -1 +0,0 @@
|
|||
marked.js.org
|
|
@ -1,74 +0,0 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to block temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team by submitting a PR with changes to the [AUTHORS](#/AUTHORS.md) page (or emailing josh@8fold.com). All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version [1.4][version].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org/
|
||||
[version]: https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
@ -1,95 +0,0 @@
|
|||
# Contributing to Marked
|
||||
|
||||
- [ ] Fork `markedjs/marked`.
|
||||
- [ ] Clone the library locally using GitHub Desktop or the command line.
|
||||
- [ ] Make sure you are on the `master` branch.
|
||||
- [ ] Be sure to run `npm install` or `npm update`.
|
||||
- [ ] Create a branch.
|
||||
- [ ] Update code in `src` folder. (`lib` folder is for auto compiled code)
|
||||
- [ ] Run `npm run test:all`, fix any broken things (for linting, you can run `npm run lint` to have the linter fix them for you).
|
||||
- [ ] Run `npm run build:reset` to remove changes to compiled files.
|
||||
- [ ] Submit a Pull Request.
|
||||
|
||||
## Design principles
|
||||
|
||||
Marked tends to favor following the SOLID set of software design and development principles; mainly the [single responsibility](https://en.wikipedia.org/wiki/Single_responsibility_principle) and [open/closed principles](https://en.wikipedia.org/wiki/Open/closed_principle):
|
||||
|
||||
- **Single responsibility:** Marked, and the components of Marked, have the single responsibility of converting Markdown strings into HTML.
|
||||
- **Open/closed:** Marked favors giving developers the means to easily extend the library and its components over changing Marked's behavior through configuration options.
|
||||
|
||||
## Priorities
|
||||
|
||||
We think we have our priorities sorted to build quality in.
|
||||
|
||||
The following table lists the ticket type labels we use when there is work to be done on the code either through an Issue or a PR; in priority order.
|
||||
|
||||
|Ticket type label |Description |
|
||||
|:----------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|L0 - security |A security vulnerability within the Marked library is discovered. |
|
||||
|L1 - broken |Valid usage results in incorrect output compared to [supported specifications](#/README.md#specifications) OR causes marked to crash AND there is no known workaround for the issue. |
|
||||
|L2 - annoying |Similar to L1 - broken only there is a known workaround available for the issue. |
|
||||
|RR - refactor and re-engineer |Results in an improvement to developers using Marked (improved readability) or end-users (faster performance) or both. |
|
||||
|NFS - new feature (spec related) |A capability Marked does not currently provide but is in one of the [supported specifications](#/README.md#specifications) |
|
||||
|NFU - new feature (user requested) |A capability Marked does not currently provide but has been requested by users of Marked. |
|
||||
|NFE - new feature (should be an extension) |A capability Marked does not currently provide and is not part of a spec. |
|
||||
|
||||
## Test early, often, and everything
|
||||
|
||||
We try to write test cases to validate output (writing tests based on the [supported specifications](#/README.md#specifications)) and minimize regression (writing tests for issues fixed). Therefore, if you would like to contribute, some things you should know regarding the test harness.
|
||||
|
||||
|Location |Description |
|
||||
|:---------------------|:--------------------------------------------------------------------------------------------------------------|
|
||||
|/test/specs/commonmark|Tests for [CommonMark](https://spec.commonmark.org/current/) compliance |
|
||||
|/test/specs/gfm |Tests for [GFM](https://github.github.com/gfm/) compliance |
|
||||
|/test/specs/new |Tests not related to the original `markdown.pl`. |
|
||||
|/test/specs/original |Tests validating against the original `markdown.pl`. |
|
||||
|/test/specs/redos |Tests for [ReDOS](https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS) vulnerabilities|
|
||||
|
||||
If your test uses features or options, assuming `gfm` is set to `false`, for example, you can add [front-matter](https://www.npmjs.com/package/front-matter) to the top of
|
||||
your `.md` file
|
||||
|
||||
``` yml
|
||||
---
|
||||
gfm: false
|
||||
---
|
||||
```
|
||||
|
||||
## Submitting PRs and Issues
|
||||
|
||||
Marked provides templates for submitting both pull requests and issues. When you begin creating a new PR or issue, you will see instructions on using the template.
|
||||
|
||||
The PR templates include checklists for both the submitter and the reviewer, which, in most cases, will not be the same person.
|
||||
|
||||
## Scripts
|
||||
|
||||
When it comes to NPM commands, we try to use the native scripts provided by the NPM framework.
|
||||
|
||||
To run the tests:
|
||||
|
||||
``` bash
|
||||
npm test
|
||||
```
|
||||
|
||||
To test whether you are using the standard syntax rules for the project:
|
||||
|
||||
```bash
|
||||
npm run test:lint
|
||||
```
|
||||
|
||||
To see time comparisons between Marked and other popular Markdown libraries:
|
||||
|
||||
```bash
|
||||
npm run bench
|
||||
```
|
||||
|
||||
To check for (and fix) standardized syntax (lint):
|
||||
|
||||
```bash
|
||||
npm run lint
|
||||
```
|
||||
|
||||
To build your own es5, esm, and minified versions of Marked:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
|
@ -1,24 +0,0 @@
|
|||
# Releasing Marked
|
||||
|
||||
- [ ] See [contributing](#/CONTRIBUTING.md)
|
||||
- [ ] Create release branch from `master` (`release-x.y.z`)
|
||||
- [ ] Submit PR with minimal name: Release x.y.z
|
||||
- [ ] Complete PR checklists
|
||||
|
||||
## Overall strategy
|
||||
|
||||
**Master is always shippable:** We try to merge PRs in such a way that `master` is the only branch to really be concerned about *and* `master` can always be released. This allows smoother flow between new features, bug fixes, and so on. (Almost a continuous deployment setup, without automation.)
|
||||
|
||||
## Versioning
|
||||
|
||||
We follow [semantic versioning](https://semver.org) where the following sequence is true `[major].[minor].[patch]`; therefore, consider the following implications of the release you are preparing:
|
||||
|
||||
1. **Major:** There is at least one change not deemed backward compatible.
|
||||
2. **Minor:** There is at least one new feature added to the release.
|
||||
3. **Patch:** No breaking changes, no new features.
|
||||
|
||||
What to expect while Marked is a zero-major (0.x.y):
|
||||
|
||||
1. The major will remain at zero; thereby, alerting consumers to the potentially volatile nature of the package.
|
||||
2. The minor will tend to be more analogous to a `major` release.
|
||||
3. The patch will tend to be more analogous to a `minor` release or a collection of bug fixes (patches).
|
|
@ -1,85 +0,0 @@
|
|||
Marked is
|
||||
|
||||
1. built for speed.<sup>*</sup>
|
||||
2. a low-level markdown compiler for parsing markdown without caching or blocking for long periods of time.<sup>**</sup>
|
||||
3. light-weight while implementing all markdown features from the supported flavors & specifications.<sup>***</sup>
|
||||
4. available as a command line interface (CLI) and running in client- or server-side JavaScript projects.
|
||||
|
||||
<p><small><sup>*</sup> Still working on metrics for comparative analysis and definition.</small><br>
|
||||
<small><sup>**</sup> As few dependencies as possible.</small><br>
|
||||
<small><sup>***</sup> Strict compliance could result in slower processing when running comparative benchmarking.</small></p>
|
||||
|
||||
|
||||
<h2 id="demo">Demo</h2>
|
||||
|
||||
Checkout the [demo page](./demo/) to see marked in action ⛹️
|
||||
|
||||
These documentation pages are also rendered using marked 💯
|
||||
|
||||
|
||||
<h2 id="installation">Installation</h2>
|
||||
|
||||
**CLI:** `npm install -g marked`
|
||||
|
||||
**In-browser:** `npm install marked`
|
||||
|
||||
<h2 id="usage">Usage</h2>
|
||||
|
||||
### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML. Please use a sanitize library, like [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [sanitize-html](https://github.com/apostrophecms/sanitize-html) or [insane](https://github.com/bevacqua/insane) on the output HTML! 🚨
|
||||
|
||||
**CLI**
|
||||
|
||||
``` bash
|
||||
$ marked -o hello.html
|
||||
hello world
|
||||
^D
|
||||
$ cat hello.html
|
||||
<p>hello world</p>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked -s "*hello world*"
|
||||
<p><em>hello world</em></p>
|
||||
```
|
||||
|
||||
**Browser**
|
||||
|
||||
```html
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Marked in the browser</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script>
|
||||
document.getElementById('content').innerHTML =
|
||||
marked('# Marked in browser\n\nRendered by **marked**.');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
|
||||
Marked offers [advanced configurations](#/USING_ADVANCED.md) and [extensibility](#/USING_PRO.md) as well.
|
||||
|
||||
<h2 id="specifications">Supported Markdown specifications</h2>
|
||||
|
||||
We actively support the features of the following [Markdown flavors](https://github.com/commonmark/CommonMark/wiki/Markdown-Flavors).
|
||||
|
||||
|Flavor |Version |
|
||||
|:----------------------------------------------------------|:----------|
|
||||
|The original markdown.pl |-- |
|
||||
|[CommonMark](http://spec.commonmark.org/0.29/) |0.29 |
|
||||
|[GitHub Flavored Markdown](https://github.github.com/gfm/) |0.29 |
|
||||
|
||||
By supporting the above Markdown flavors, it's possible that Marked can help you use other flavors as well; however, these are not actively supported by the community.
|
||||
|
||||
<h2 id="security">Security</h2>
|
||||
|
||||
The only completely secure system is the one that doesn't exist in the first place. Having said that, we take the security of Marked very seriously.
|
||||
|
||||
Therefore, please disclose potential security issues by email to the project [committers](#/AUTHORS.md) as well as the [listed owners within NPM](https://docs.npmjs.com/cli/owner). We will provide an initial assessment of security reports within 48 hours and should apply patches within 2 weeks (also, feel free to contribute a fix for the issue).
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
## The `marked` function
|
||||
|
||||
```js
|
||||
marked(markdownString [,options] [,callback])
|
||||
```
|
||||
|
||||
|Argument |Type |Notes |
|
||||
|:---------------------|:------------|:----------------------------------------------------------------------------------------------------|
|
||||
|markdownString |`string` |String of markdown source to be compiled. |
|
||||
|<a href="#options">options</a>|`object`|Hash of options. Can also use `marked.setOptions`. |
|
||||
|callback |`function` |Called when `markdownString` has been parsed. Can be used as second argument if no `options` present.|
|
||||
|
||||
### Alternative using reference
|
||||
|
||||
```js
|
||||
// Create reference instance
|
||||
const marked = require('marked');
|
||||
|
||||
// Set options
|
||||
// `highlight` example uses `highlight.js`
|
||||
marked.setOptions({
|
||||
renderer: new marked.Renderer(),
|
||||
highlight: function(code, language) {
|
||||
const hljs = require('highlight.js');
|
||||
const validLanguage = hljs.getLanguage(language) ? language : 'plaintext';
|
||||
return hljs.highlight(validLanguage, code).value;
|
||||
},
|
||||
pedantic: false,
|
||||
gfm: true,
|
||||
breaks: false,
|
||||
sanitize: false,
|
||||
smartLists: true,
|
||||
smartypants: false,
|
||||
xhtml: false
|
||||
});
|
||||
|
||||
// Compile
|
||||
console.log(marked(markdownString));
|
||||
```
|
||||
|
||||
<h2 id="options">Options</h2>
|
||||
|
||||
|Member |Type |Default |Since |Notes |
|
||||
|:-----------|:---------|:--------|:--------|:-------------|
|
||||
|baseUrl |`string` |`null` |0.3.9 |A prefix url for any relative link. |
|
||||
|breaks |`boolean` |`false` |v0.2.7 |If true, add `<br>` on a single line break (copies GitHub behavior on comments, but not on rendered markdown files). Requires `gfm` be `true`.|
|
||||
|gfm |`boolean` |`true` |v0.2.1 |If true, use approved [GitHub Flavored Markdown (GFM) specification](https://github.github.com/gfm/).|
|
||||
|headerIds |`boolean` |`true` |v0.4.0 |If true, include an `id` attribute when emitting headings (h1, h2, h3, etc).|
|
||||
|headerPrefix|`string` |`''` |v0.3.0 |A string to prefix the `id` attribute when emitting headings (h1, h2, h3, etc).|
|
||||
|highlight |`function`|`null` |v0.3.0 |A function to highlight code blocks, see <a href="#highlight">Asynchronous highlighting</a>.|
|
||||
|langPrefix |`string` |`'language-'`|v0.3.0|A string to prefix the className in a `<code>` block. Useful for syntax highlighting.|
|
||||
|mangle |`boolean` |`true` |v0.3.4 |If true, autolinked email address is escaped with HTML character references.|
|
||||
|pedantic |`boolean` |`false` |v0.2.1 |If true, conform to the original `markdown.pl` as much as possible. Don't fix original markdown bugs or behavior. Turns off and overrides `gfm`.|
|
||||
|renderer |`object` |`new Renderer()`|v0.3.0|An object containing functions to render tokens to HTML. See [extensibility](/#/USING_PRO.md) for more details.|
|
||||
|sanitize |`boolean` |`false` |v0.2.1 |If true, sanitize the HTML passed into `markdownString` with the `sanitizer` function.<br>**Warning**: This feature is deprecated and it should NOT be used as it cannot be considered secure.<br>Instead use a sanitize library, like [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [sanitize-html](https://github.com/apostrophecms/sanitize-html) or [insane](https://github.com/bevacqua/insane) on the output HTML! |
|
||||
|sanitizer |`function`|`null` |v0.3.4 |A function to sanitize the HTML passed into `markdownString`.|
|
||||
|silent |`boolean` |`false` |v0.2.7 |If true, the parser does not throw any exception.|
|
||||
|smartLists |`boolean` |`false` |v0.2.8 |If true, use smarter list behavior than those found in `markdown.pl`.|
|
||||
|smartypants |`boolean` |`false` |v0.2.9 |If true, use "smart" typographic punctuation for things like quotes and dashes.|
|
||||
|tokenizer |`object` |`new Tokenizer()`|v1.0.0|An object containing functions to create tokens from markdown. See [extensibility](/#/USING_PRO.md) for more details.|
|
||||
|walkTokens |`function` |`null`|v1.1.0|A function which is called for every token. See [extensibility](/#/USING_PRO.md) for more details.|
|
||||
|xhtml |`boolean` |`false` |v0.3.2 |If true, emit self-closing HTML tags for void elements (<br/>, <img/>, etc.) with a "/" as required by XHTML.|
|
||||
|
||||
<h2 id="highlight">Asynchronous highlighting</h2>
|
||||
|
||||
Unlike `highlight.js` the `pygmentize.js` library uses asynchronous highlighting. This example demonstrates that marked is agnostic when it comes to the highlighter you use.
|
||||
|
||||
```js
|
||||
marked.setOptions({
|
||||
highlight: function(code, lang, callback) {
|
||||
require('pygmentize-bundled') ({ lang: lang, format: 'html' }, code, function (err, result) {
|
||||
callback(err, result.toString());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
console.log(marked(markdownString));
|
||||
```
|
||||
|
||||
In both examples, `code` is a `string` representing the section of code to pass to the highlighter. In this example, `lang` is a `string` informing the highlighter what programming language to use for the `code` and `callback` is the `function` the asynchronous highlighter will call once complete.
|
||||
|
||||
<h2 id="workers">Workers</h2>
|
||||
|
||||
To prevent ReDoS attacks you can run marked on a worker and terminate it when parsing takes longer than usual.
|
||||
|
||||
Marked can be run in a [worker thread](https://nodejs.org/api/worker_threads.html) on a node server, or a [web worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) in a browser.
|
||||
|
||||
### Node Worker Thread
|
||||
|
||||
```js
|
||||
// markedWorker.js
|
||||
|
||||
const marked = require('marked');
|
||||
const { parentPort } = require('worker_threads');
|
||||
|
||||
parentPort.on('message', (markdownString) => {
|
||||
parentPort.postMessage(marked(markdownString));
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
// index.js
|
||||
|
||||
const { Worker } = require('worker_threads');
|
||||
const markedWorker = new Worker('./markedWorker.js');
|
||||
|
||||
const markedTimeout = setTimeout(() => {
|
||||
markedWorker.terminate();
|
||||
throw new Error('Marked took too long!');
|
||||
}, timeoutLimit);
|
||||
|
||||
markedWorker.on('message', (html) => {
|
||||
clearTimeout(markedTimeout);
|
||||
console.log(html);
|
||||
markedWorker.terminate();
|
||||
});
|
||||
|
||||
markedWorker.postMessage(markdownString);
|
||||
```
|
||||
|
||||
### Web Worker
|
||||
|
||||
> **NOTE**: Web Workers send the payload from `postMessage` in an object with the payload in a `.data` property
|
||||
|
||||
```js
|
||||
// markedWorker.js
|
||||
|
||||
importScripts('path/to/marked.min.js');
|
||||
|
||||
onmessage = (e) => {
|
||||
const markdownString = e.data
|
||||
postMessage(marked(markdownString));
|
||||
};
|
||||
```
|
||||
|
||||
```js
|
||||
// script.js
|
||||
|
||||
const markedWorker = new Worker('./markedWorker.js');
|
||||
|
||||
const markedTimeout = setTimeout(() => {
|
||||
markedWorker.terminate();
|
||||
throw new Error('Marked took too long!');
|
||||
}, timeoutLimit);
|
||||
|
||||
markedWorker.onmessage = (e) => {
|
||||
clearTimeout(markedTimeout);
|
||||
const html = e.data;
|
||||
console.log(html);
|
||||
markedWorker.terminate();
|
||||
};
|
||||
|
||||
markedWorker.postMessage(markdownString);
|
||||
```
|
|
@ -1,352 +0,0 @@
|
|||
## Extending Marked
|
||||
|
||||
To champion the single-responsibility and open/closed principles, we have tried to make it relatively painless to extend marked. If you are looking to add custom functionality, this is the place to start.
|
||||
|
||||
<h2 id="use">marked.use()</h2>
|
||||
|
||||
`marked.use(options)` is the recommended way to extend marked. The options object can contain any [option](#/USING_ADVANCED.md#options) available in marked.
|
||||
|
||||
The `renderer` and `tokenizer` options can be an object with functions that will be merged into the `renderer` and `tokenizer` respectively.
|
||||
|
||||
The `renderer` and `tokenizer` functions can return false to fallback to the previous function.
|
||||
|
||||
The `walkTokens` option can be a function that will be called with every token before rendering. When calling `use` multiple times with different `walkTokens` functions each function will be called in the **reverse** order in which they were assigned.
|
||||
|
||||
All other options will overwrite previously set options.
|
||||
|
||||
<h2 id="renderer">The renderer</h2>
|
||||
|
||||
The renderer defines the output of the parser.
|
||||
|
||||
**Example:** Overriding default heading token by adding an embedded anchor tag like on GitHub.
|
||||
|
||||
```js
|
||||
// Create reference instance
|
||||
const marked = require('marked');
|
||||
|
||||
// Override function
|
||||
const renderer = {
|
||||
heading(text, level) {
|
||||
const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
|
||||
|
||||
return `
|
||||
<h${level}>
|
||||
<a name="${escapedText}" class="anchor" href="#${escapedText}">
|
||||
<span class="header-link"></span>
|
||||
</a>
|
||||
${text}
|
||||
</h${level}>`;
|
||||
}
|
||||
};
|
||||
|
||||
marked.use({ renderer });
|
||||
|
||||
// Run marked
|
||||
console.log(marked('# heading+'));
|
||||
```
|
||||
|
||||
**Output:**
|
||||
|
||||
```html
|
||||
<h1>
|
||||
<a name="heading-" class="anchor" href="#heading-">
|
||||
<span class="header-link"></span>
|
||||
</a>
|
||||
heading+
|
||||
</h1>
|
||||
```
|
||||
|
||||
### Block level renderer methods
|
||||
|
||||
- code(*string* code, *string* infostring, *boolean* escaped)
|
||||
- blockquote(*string* quote)
|
||||
- html(*string* html)
|
||||
- heading(*string* text, *number* level, *string* raw, *Slugger* slugger)
|
||||
- hr()
|
||||
- list(*string* body, *boolean* ordered, *number* start)
|
||||
- listitem(*string* text, *boolean* task, *boolean* checked)
|
||||
- checkbox(*boolean* checked)
|
||||
- paragraph(*string* text)
|
||||
- table(*string* header, *string* body)
|
||||
- tablerow(*string* content)
|
||||
- tablecell(*string* content, *object* flags)
|
||||
|
||||
`slugger` has the `slug` method to create a unique id from value:
|
||||
|
||||
```js
|
||||
slugger.slug('foo') // foo
|
||||
slugger.slug('foo') // foo-1
|
||||
slugger.slug('foo') // foo-2
|
||||
slugger.slug('foo 1') // foo-1-1
|
||||
slugger.slug('foo-1') // foo-1-2
|
||||
...
|
||||
```
|
||||
|
||||
`flags` has the following properties:
|
||||
|
||||
```js
|
||||
{
|
||||
header: true || false,
|
||||
align: 'center' || 'left' || 'right'
|
||||
}
|
||||
```
|
||||
|
||||
### Inline level renderer methods
|
||||
|
||||
- strong(*string* text)
|
||||
- em(*string* text)
|
||||
- codespan(*string* code)
|
||||
- br()
|
||||
- del(*string* text)
|
||||
- link(*string* href, *string* title, *string* text)
|
||||
- image(*string* href, *string* title, *string* text)
|
||||
- text(*string* text)
|
||||
|
||||
<h2 id="tokenizer">The tokenizer</h2>
|
||||
|
||||
The tokenizer defines how to turn markdown text into tokens.
|
||||
|
||||
**Example:** Overriding default `codespan` tokenizer to include LaTeX.
|
||||
|
||||
```js
|
||||
// Create reference instance
|
||||
const marked = require('marked');
|
||||
|
||||
// Override function
|
||||
const tokenizer = {
|
||||
codespan(src) {
|
||||
const match = src.match(/\$+([^\$\n]+?)\$+/);
|
||||
if (match) {
|
||||
return {
|
||||
type: 'codespan',
|
||||
raw: match[0],
|
||||
text: match[1].trim()
|
||||
};
|
||||
}
|
||||
|
||||
// return false to use original codespan tokenizer
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
marked.use({ tokenizer });
|
||||
|
||||
// Run marked
|
||||
console.log(marked('$ latex code $\n\n` other code `'));
|
||||
```
|
||||
|
||||
**Output:**
|
||||
|
||||
```html
|
||||
<p><code>latex code</code></p>
|
||||
<p><code>other code</code></p>
|
||||
```
|
||||
|
||||
### Block level tokenizer methods
|
||||
|
||||
- space(*string* src)
|
||||
- code(*string* src, *array* tokens)
|
||||
- fences(*string* src)
|
||||
- heading(*string* src)
|
||||
- nptable(*string* src)
|
||||
- hr(*string* src)
|
||||
- blockquote(*string* src)
|
||||
- list(*string* src)
|
||||
- html(*string* src)
|
||||
- def(*string* src)
|
||||
- table(*string* src)
|
||||
- lheading(*string* src)
|
||||
- paragraph(*string* src)
|
||||
- text(*string* src, *array* tokens)
|
||||
|
||||
### Inline level tokenizer methods
|
||||
|
||||
- escape(*string* src)
|
||||
- tag(*string* src, *bool* inLink, *bool* inRawBlock)
|
||||
- link(*string* src)
|
||||
- reflink(*string* src, *object* links)
|
||||
- strong(*string* src)
|
||||
- em(*string* src)
|
||||
- codespan(*string* src)
|
||||
- br(*string* src)
|
||||
- del(*string* src)
|
||||
- autolink(*string* src, *function* mangle)
|
||||
- url(*string* src, *function* mangle)
|
||||
- inlineText(*string* src, *bool* inRawBlock, *function* smartypants)
|
||||
|
||||
`mangle` is a method that changes text to HTML character references:
|
||||
|
||||
```js
|
||||
mangle('test@example.com')
|
||||
// "test@example.com"
|
||||
```
|
||||
|
||||
`smartypants` is a method that translates plain ASCII punctuation characters into “smart” typographic punctuation HTML entities:
|
||||
|
||||
https://daringfireball.net/projects/smartypants/
|
||||
|
||||
```js
|
||||
smartypants('"this ... string"')
|
||||
// "“this … string”"
|
||||
```
|
||||
|
||||
<h2 id="walk-tokens">Walk Tokens</h2>
|
||||
|
||||
The walkTokens function gets called with every token. Child tokens are called before moving on to sibling tokens. Each token is passed by reference so updates are persisted when passed to the parser. The return value of the function is ignored.
|
||||
|
||||
**Example:** Overriding heading tokens to start at h2.
|
||||
|
||||
```js
|
||||
const marked = require('marked');
|
||||
|
||||
// Override function
|
||||
const walkTokens = (token) => {
|
||||
if (token.type === 'heading') {
|
||||
token.depth += 1;
|
||||
}
|
||||
};
|
||||
|
||||
marked.use({ walkTokens });
|
||||
|
||||
// Run marked
|
||||
console.log(marked('# heading 2\n\n## heading 3'));
|
||||
```
|
||||
|
||||
**Output:**
|
||||
|
||||
```html
|
||||
<h2 id="heading-2">heading 2</h2>
|
||||
<h3 id="heading-3">heading 3</h3>
|
||||
```
|
||||
|
||||
<h2 id="lexer">The lexer</h2>
|
||||
|
||||
The lexer takes a markdown string and calls the tokenizer functions.
|
||||
|
||||
<h2 id="parser">The parser</h2>
|
||||
|
||||
The parser takes tokens as input and calls the renderer functions.
|
||||
|
||||
***
|
||||
|
||||
<h2 id="extend">Access to lexer and parser</h2>
|
||||
|
||||
You also have direct access to the lexer and parser if you so desire.
|
||||
|
||||
``` js
|
||||
const tokens = marked.lexer(markdown, options);
|
||||
console.log(marked.parser(tokens, options));
|
||||
```
|
||||
|
||||
``` js
|
||||
const lexer = new marked.Lexer(options);
|
||||
const tokens = lexer.lex(markdown);
|
||||
console.log(tokens);
|
||||
console.log(lexer.tokenizer.rules.block); // block level rules used
|
||||
console.log(lexer.tokenizer.rules.inline); // inline level rules used
|
||||
console.log(marked.Lexer.rules.block); // all block level rules
|
||||
console.log(marked.Lexer.rules.inline); // all inline level rules
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ node
|
||||
> require('marked').lexer('> I am using marked.')
|
||||
[
|
||||
{
|
||||
type: "blockquote",
|
||||
raw: "> I am using marked.",
|
||||
tokens: [
|
||||
{
|
||||
type: "paragraph",
|
||||
raw: "I am using marked.",
|
||||
text: "I am using marked.",
|
||||
tokens: [
|
||||
{
|
||||
type: "text",
|
||||
raw: "I am using marked.",
|
||||
text: "I am using marked."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
links: {}
|
||||
]
|
||||
```
|
||||
|
||||
The Lexer builds an array of tokens, which will be passed to the Parser.
|
||||
The Parser processes each token in the token array:
|
||||
|
||||
``` js
|
||||
const marked = require('marked');
|
||||
|
||||
const md = `
|
||||
# heading
|
||||
|
||||
[link][1]
|
||||
|
||||
[1]: #heading "heading"
|
||||
`;
|
||||
|
||||
const tokens = marked.lexer(md);
|
||||
console.log(tokens);
|
||||
|
||||
const html = marked.parser(tokens);
|
||||
console.log(html);
|
||||
```
|
||||
|
||||
``` bash
|
||||
[
|
||||
{
|
||||
type: "heading",
|
||||
raw: " # heading\n\n",
|
||||
depth: 1,
|
||||
text: "heading",
|
||||
tokens: [
|
||||
{
|
||||
type: "text",
|
||||
raw: "heading",
|
||||
text: "heading"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "paragraph",
|
||||
raw: " [link][1]",
|
||||
text: " [link][1]",
|
||||
tokens: [
|
||||
{
|
||||
type: "text",
|
||||
raw: " ",
|
||||
text: " "
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
raw: "[link][1]",
|
||||
text: "link",
|
||||
href: "#heading",
|
||||
title: "heading",
|
||||
tokens: [
|
||||
{
|
||||
type: "text",
|
||||
raw: "link",
|
||||
text: "link"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "space",
|
||||
raw: "\n\n"
|
||||
},
|
||||
links: {
|
||||
"1": {
|
||||
href: "#heading",
|
||||
title: "heading"
|
||||
}
|
||||
}
|
||||
]
|
||||
<h1 id="heading">heading</h1>
|
||||
<p> <a href="#heading" title="heading">link</a></p>
|
||||
```
|
|
@ -1,426 +0,0 @@
|
|||
# Markdown is broken
|
||||
|
||||
I have a lot of scraps of markdown engine oddities that I've collected over the
|
||||
years. What you see below is slightly messy, but it's what I've managed to
|
||||
cobble together to illustrate the differences between markdown engines, and
|
||||
why, if there ever is a markdown specification, it has to be absolutely
|
||||
thorough. There are a lot more of these little differences I have documented
|
||||
elsewhere. I know I will find them lingering on my disk one day, but until
|
||||
then, I'll continue to add whatever strange nonsensical things I find.
|
||||
|
||||
Some of these examples may only mention a particular engine compared to marked.
|
||||
However, the examples with markdown.pl could easily be swapped out for
|
||||
discount, upskirt, or markdown.js, and you would very easily see even more
|
||||
inconsistencies.
|
||||
|
||||
A lot of this was written when I was very unsatisfied with the inconsistencies
|
||||
between markdown engines. Please excuse the frustration noticeable in my
|
||||
writing.
|
||||
|
||||
## Examples of markdown's "stupid" list parsing
|
||||
|
||||
```
|
||||
$ markdown.pl
|
||||
|
||||
* item1
|
||||
|
||||
* item2
|
||||
|
||||
text
|
||||
^D
|
||||
<ul>
|
||||
<li><p>item1</p>
|
||||
|
||||
<ul>
|
||||
<li>item2</li>
|
||||
</ul>
|
||||
|
||||
<p><p>text</p></li>
|
||||
</ul></p>
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
$ marked
|
||||
* item1
|
||||
|
||||
* item2
|
||||
|
||||
text
|
||||
^D
|
||||
<ul>
|
||||
<li><p>item1</p>
|
||||
<ul>
|
||||
<li>item2</li>
|
||||
</ul>
|
||||
<p>text</p>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
Which looks correct to you?
|
||||
|
||||
- - -
|
||||
|
||||
```
|
||||
$ markdown.pl
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<p><ul>
|
||||
<li>hello</p>
|
||||
|
||||
<blockquote>
|
||||
<p>world</li>
|
||||
</ul></p>
|
||||
</blockquote>
|
||||
```
|
||||
|
||||
```
|
||||
$ marked
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<ul>
|
||||
<li>hello<blockquote>
|
||||
<p>world</p>
|
||||
</blockquote>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
Again, which looks correct to you?
|
||||
|
||||
- - -
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
```
|
||||
$ markdown.pl
|
||||
* hello
|
||||
* world
|
||||
* hi
|
||||
code
|
||||
^D
|
||||
<ul>
|
||||
<li>hello
|
||||
<ul>
|
||||
<li>world</li>
|
||||
<li>hi
|
||||
code</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
The code isn't a code block even though it's after the bullet margin. I know,
|
||||
lets give it two more spaces, effectively making it 8 spaces past the bullet.
|
||||
|
||||
```
|
||||
$ markdown.pl
|
||||
* hello
|
||||
* world
|
||||
* hi
|
||||
code
|
||||
^D
|
||||
<ul>
|
||||
<li>hello
|
||||
<ul>
|
||||
<li>world</li>
|
||||
<li>hi
|
||||
code</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
And, it's still not a code block. Did you also notice that the 3rd item isn't
|
||||
even its own list? Markdown screws that up too because of its indentation
|
||||
unaware parsing.
|
||||
|
||||
- - -
|
||||
|
||||
Let's look at some more examples of markdown's list parsing:
|
||||
|
||||
```
|
||||
$ markdown.pl
|
||||
|
||||
* item1
|
||||
|
||||
* item2
|
||||
|
||||
text
|
||||
^D
|
||||
<ul>
|
||||
<li><p>item1</p>
|
||||
|
||||
<ul>
|
||||
<li>item2</li>
|
||||
</ul>
|
||||
|
||||
<p><p>text</p></li>
|
||||
</ul></p>
|
||||
```
|
||||
|
||||
Misnested tags.
|
||||
|
||||
|
||||
```
|
||||
$ marked
|
||||
* item1
|
||||
|
||||
* item2
|
||||
|
||||
text
|
||||
^D
|
||||
<ul>
|
||||
<li><p>item1</p>
|
||||
<ul>
|
||||
<li>item2</li>
|
||||
</ul>
|
||||
<p>text</p>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
Which looks correct to you?
|
||||
|
||||
- - -
|
||||
|
||||
```
|
||||
$ markdown.pl
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<p><ul>
|
||||
<li>hello</p>
|
||||
|
||||
<blockquote>
|
||||
<p>world</li>
|
||||
</ul></p>
|
||||
</blockquote>
|
||||
```
|
||||
|
||||
More misnested tags.
|
||||
|
||||
|
||||
```
|
||||
$ marked
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<ul>
|
||||
<li>hello<blockquote>
|
||||
<p>world</p>
|
||||
</blockquote>
|
||||
</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
Again, which looks correct to you?
|
||||
|
||||
- - -
|
||||
|
||||
# Why quality matters - Part 2
|
||||
|
||||
``` bash
|
||||
$ markdown.pl
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<p><ul>
|
||||
<li>hello</p>
|
||||
|
||||
<blockquote>
|
||||
<p>world</li>
|
||||
</ul></p>
|
||||
</blockquote>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ sundown # upskirt
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<ul>
|
||||
<li>hello
|
||||
> world</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked
|
||||
* hello
|
||||
> world
|
||||
^D
|
||||
<ul><li>hello <blockquote><p>world</p></blockquote></li></ul>
|
||||
```
|
||||
|
||||
Which looks correct to you?
|
||||
|
||||
- - -
|
||||
|
||||
See: https://github.com/evilstreak/markdown-js/issues/23
|
||||
|
||||
``` bash
|
||||
$ markdown.pl # upskirt/markdown.js/discount
|
||||
* hello
|
||||
var a = 1;
|
||||
* world
|
||||
^D
|
||||
<ul>
|
||||
<li>hello
|
||||
var a = 1;</li>
|
||||
<li>world</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked
|
||||
* hello
|
||||
var a = 1;
|
||||
* world
|
||||
^D
|
||||
<ul><li>hello
|
||||
<pre>code>var a = 1;</code></pre></li>
|
||||
<li>world</li></ul>
|
||||
```
|
||||
|
||||
Which looks more reasonable? Why shouldn't code blocks be able to appear in
|
||||
list items in a sane way?
|
||||
|
||||
- - -
|
||||
|
||||
``` bash
|
||||
$ markdown.js
|
||||
<div>hello</div>
|
||||
|
||||
<span>hello</span>
|
||||
^D
|
||||
<p><div>hello</div></p>
|
||||
|
||||
<p><span>hello</span></p>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked
|
||||
<div>hello</div>
|
||||
|
||||
<span>hello</span>
|
||||
^D
|
||||
<div>hello</div>
|
||||
|
||||
|
||||
<p><span>hello</span>
|
||||
</p>
|
||||
```
|
||||
|
||||
- - -
|
||||
|
||||
See: https://github.com/evilstreak/markdown-js/issues/27
|
||||
|
||||
``` bash
|
||||
$ markdown.js
|
||||
[](/link)
|
||||
^D
|
||||
<p><a href="/image)](/link">](/link)
|
||||
^D
|
||||
<p><a href="/link"><img src="/image" alt="an image"></a>
|
||||
</p>
|
||||
```
|
||||
|
||||
- - -
|
||||
|
||||
See: https://github.com/evilstreak/markdown-js/issues/24
|
||||
|
||||
``` bash
|
||||
$ markdown.js
|
||||
> a
|
||||
|
||||
> b
|
||||
|
||||
> c
|
||||
^D
|
||||
<blockquote><p>a</p><p>bundefined> c</p></blockquote>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked
|
||||
> a
|
||||
|
||||
> b
|
||||
|
||||
> c
|
||||
^D
|
||||
<blockquote><p>a
|
||||
|
||||
</p></blockquote>
|
||||
<blockquote><p>b
|
||||
|
||||
</p></blockquote>
|
||||
<blockquote><p>c
|
||||
</p></blockquote>
|
||||
```
|
||||
|
||||
- - -
|
||||
|
||||
``` bash
|
||||
$ markdown.pl
|
||||
* hello
|
||||
* world
|
||||
how
|
||||
|
||||
are
|
||||
you
|
||||
|
||||
* today
|
||||
* hi
|
||||
^D
|
||||
<ul>
|
||||
<li><p>hello</p>
|
||||
|
||||
<ul>
|
||||
<li>world
|
||||
how</li>
|
||||
</ul>
|
||||
|
||||
<p>are
|
||||
you</p>
|
||||
|
||||
<ul>
|
||||
<li>today</li>
|
||||
</ul></li>
|
||||
<li>hi</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
``` bash
|
||||
$ marked
|
||||
* hello
|
||||
* world
|
||||
how
|
||||
|
||||
are
|
||||
you
|
||||
|
||||
* today
|
||||
* hi
|
||||
^D
|
||||
<ul>
|
||||
<li><p>hello</p>
|
||||
<ul>
|
||||
<li><p>world
|
||||
how</p>
|
||||
<p>are
|
||||
you</p>
|
||||
</li>
|
||||
<li><p>today</p>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>hi</li>
|
||||
</ul>
|
||||
```
|
|
@ -1,133 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="996px" height="439.589px" viewBox="0 0 996 439.589" enable-background="new 0 0 996 439.589" xml:space="preserve">
|
||||
<g>
|
||||
<g id="Marked_Letters">
|
||||
<path fill="#010101" d="M185.044,358.869h-9.961l-1.143-25.986l-14.092,25.986h-6.24l-6.709-26.807l-8.818,26.807h-10.225
|
||||
l13.389-40.605h10.928l6.416,25.781l13.916-25.781h10.635L185.044,358.869z"/>
|
||||
<path fill="#010101" d="M226.617,358.869h-10.811l-1.084-8.994H202.33l-4.102,8.994h-10.605l20.566-40.605h10.986L226.617,358.869
|
||||
z M214.019,344.162l-1.934-15.527l-7.061,15.527H214.019z"/>
|
||||
<path fill="#010101" d="M267.712,358.869h-11.338l-4.043-8.467c-1.191-2.559-2.227-4.478-3.105-5.757s-1.651-2.07-2.314-2.373
|
||||
c-0.664-0.303-1.553-0.454-2.666-0.454h-1.553l-2.578,17.051h-10.283l5.889-40.605h15.85c5.761,0,9.672,1.27,11.733,3.809
|
||||
c2.061,2.539,3.091,5.283,3.091,8.232c0,3.105-0.854,5.522-2.563,7.251c-1.709,1.729-4.097,2.798-7.163,3.208
|
||||
c1.562,0.898,2.769,1.953,3.618,3.164s1.86,3.096,3.032,5.654L267.712,358.869z M255.525,330.012c0-1.562-0.571-2.925-1.714-4.087
|
||||
s-3.453-1.743-6.929-1.743h-1.611l-1.699,11.719h4.102c2.89,0,4.922-0.61,6.094-1.831S255.525,331.496,255.525,330.012z"/>
|
||||
<path fill="#010101" d="M313.705,318.264l-17.578,18.223l14.912,22.383h-11.807l-14.59-21.65l-3.282,21.65h-10.342l6.064-40.605
|
||||
h10.401l-2.578,17.256l16.611-17.256H313.705z"/>
|
||||
<path fill="#010101" d="M346.426,318.264L345.4,325.5h-16.436l-1.26,8.818h14.268l-1.025,7.266h-14.385l-1.377,10.02h19.98
|
||||
l-1.025,7.266h-30.439l5.889-40.605H346.426z"/>
|
||||
<path fill="#010101" d="M389.953,338.156c0,4.512-0.86,8.301-2.578,11.367c-1.719,3.066-4.273,5.391-7.662,6.973
|
||||
s-7.583,2.373-12.582,2.373H348.41l5.83-40.605h14.941c3.534,0,6.625,0.527,9.271,1.582s4.82,2.51,6.52,4.365
|
||||
s2.953,3.97,3.764,6.343S389.953,335.461,389.953,338.156z M379.377,338.303c0-2.031-0.387-4.004-1.158-5.918
|
||||
s-2.192-3.54-4.262-4.878c-2.07-1.338-4.941-2.007-8.613-2.007h-1.67l-3.779,26.104h5.449c2.597,0,4.828-0.391,6.693-1.172
|
||||
s3.33-1.821,4.395-3.12s1.821-2.71,2.271-4.233C379.152,341.555,379.377,339.963,379.377,338.303z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#010101" d="M406.922,307.149l-3.703,26.35c-0.609,4.324-2.72,6.486-6.33,6.486c-0.773,0-1.553-0.07-2.338-0.211
|
||||
l-0.756-3.023c0.879,0.188,1.67,0.281,2.373,0.281c1.219,0,2.118-0.302,2.698-0.905s0.964-1.55,1.151-2.839l3.674-26.139H406.922z
|
||||
"/>
|
||||
<path fill="#010101" d="M423.027,307.8l-0.475,3.357c-1.312-0.867-2.748-1.301-4.307-1.301c-1.312,0-2.361,0.34-3.146,1.02
|
||||
s-1.178,1.576-1.178,2.689c0,0.551,0.188,1.131,0.562,1.74s1.471,1.644,3.287,3.103s3.015,2.739,3.595,3.841
|
||||
s0.87,2.203,0.87,3.305c0,1.758-0.662,3.275-1.986,4.553s-3.088,1.916-5.291,1.916c-1.957,0-3.938-0.586-5.941-1.758l0.51-3.604
|
||||
c2.238,1.559,4.16,2.338,5.766,2.338c0.867,0,1.69-0.284,2.47-0.852c0.779-0.568,1.169-1.339,1.169-2.312
|
||||
c0-0.62-0.197-1.265-0.59-1.933c-0.394-0.667-1.502-1.745-3.324-3.232c-1.824-1.486-3.014-2.778-3.568-3.874
|
||||
c-0.555-1.097-0.832-2.185-0.832-3.263c0-1.899,0.785-3.491,2.355-4.775c1.57-1.283,3.422-1.926,5.555-1.926
|
||||
C420.016,306.833,421.516,307.155,423.027,307.8z"/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#010101" d="M357,200v-92c0-8.284-6.716-15-15-15H172c-8.284,0-15,6.716-15,15v92H357z"/>
|
||||
<path fill="#010101" d="M157,205v73c0,8.284,6.716,15,15,15h170c8.284,0,15-6.716,15-15v-73H157z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M208.737,180.15v-33.125l16.987,21.234l16.987-21.234v33.125h16.987v-57.756h-16.987l-16.987,21.234
|
||||
l-16.987-21.234H191.75v57.756H208.737z"/>
|
||||
<path fill="#FFFFFF" d="M322.55,151.272h-16.987v-28.878h-16.986v28.878h-16.987L297.069,181L322.55,151.272z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M217,241.154c0,2.124-1.722,3.846-3.845,3.846h-5.31c-2.124,0-3.845-1.722-3.845-3.846v-0.309
|
||||
c0-2.124,1.722-3.846,3.845-3.846h5.31c2.124,0,3.845,1.722,3.845,3.846V241.154z"/>
|
||||
<path fill="#FFFFFF" d="M207.859,256.5c0,1.933-1.1,3.5-2.457,3.5h-12.046c-1.357,0-2.457-1.567-2.457-3.5l0,0
|
||||
c0-1.933,1.1-3.5,2.457-3.5h12.046C206.759,253,207.859,254.567,207.859,256.5L207.859,256.5z"/>
|
||||
<path fill="#FFFFFF" d="M328.044,238.021c-1.058-3.094-2.692-5.85-4.907-8.269c-2.215-2.418-5.049-4.314-8.498-5.689
|
||||
c-3.45-1.375-7.479-2.063-12.086-2.063h-19.477l-7.6,52.932h24.403c6.518,0,11.984-1.032,16.402-3.094
|
||||
c4.416-2.062,7.746-5.092,9.986-9.09c2.24-3.996,3.361-8.936,3.361-14.817C329.629,244.418,329.1,241.115,328.044,238.021z
|
||||
M314.964,254.347c-0.586,1.986-1.573,3.826-2.96,5.519c-1.389,1.694-3.297,3.049-5.729,4.067s-5.34,1.528-8.727,1.528h-7.103
|
||||
l4.927-34.027h2.176c4.787,0,8.529,0.872,11.229,2.616c2.698,1.744,4.55,3.863,5.557,6.358c1.005,2.494,1.508,5.066,1.508,7.713
|
||||
C315.842,250.286,315.549,252.361,314.964,254.347z"/>
|
||||
<path fill="#FFFFFF" d="M246.148,241.043l1.373-9.61h21.424l1.336-9.434h-10.601h-24.38h-1.256c-2.125,0-3.846,1.877-3.846,4
|
||||
s1.721,4,3.846,4h0.096h3.793c1.928,0,3.491,1.563,3.491,3.491c0,1.928-1.563,3.491-3.491,3.491h-4.806L233.126,237h-8.983
|
||||
c-1.299,0-2.353,1.786-2.353,3.988c0,2.203,1.053,3.989,2.353,3.989h7.826L231.966,245h3.189c2.124,0,3.845,1.722,3.845,3.846
|
||||
v0.309c0,2.124-1.722,3.846-3.845,3.846h-4.349h-0.96H216.2c-1.933,0-3.5,1.567-3.5,3.5s1.567,3.5,3.5,3.5h8.645h4.945h0.364
|
||||
c2.124,0,3.845,1.722,3.845,3.846v0.309c0,2.124-1.722,3.846-3.845,3.846h-1.524h-3.785h-1.8c-2.125,0-3.846,1.377-3.846,3.5
|
||||
s1.721,3.5,3.846,3.5h25.636c0.273,0,0.538-0.024,0.795-0.068h17.828l1.336-9.471h-26.045l1.795-13.062h18.751l1.336-9.471
|
||||
h-18.598l0.029-0.205C246.055,242.213,246.144,241.647,246.148,241.043z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g id="Marked_Letters_1_">
|
||||
<path fill="#010101" d="M619.045,356.869h-9.961l-1.143-25.986l-14.092,25.986h-6.24l-6.709-26.807l-8.818,26.807h-10.225
|
||||
l13.389-40.605h10.928l6.416,25.781l13.916-25.781h10.635L619.045,356.869z"/>
|
||||
<path fill="#010101" d="M660.617,356.869h-10.811l-1.084-8.994H636.33l-4.102,8.994h-10.605l20.566-40.605h10.986L660.617,356.869
|
||||
z M648.02,342.162l-1.934-15.527l-7.061,15.527H648.02z"/>
|
||||
<path fill="#010101" d="M701.713,356.869h-11.338l-4.043-8.467c-1.191-2.559-2.227-4.478-3.105-5.757s-1.651-2.07-2.314-2.373
|
||||
c-0.664-0.303-1.553-0.454-2.666-0.454h-1.553l-2.578,17.051h-10.283l5.889-40.605h15.85c5.761,0,9.672,1.27,11.732,3.809
|
||||
s3.092,5.283,3.092,8.232c0,3.105-0.855,5.522-2.564,7.251s-4.097,2.798-7.162,3.208c1.562,0.898,2.768,1.953,3.617,3.164
|
||||
s1.861,3.096,3.033,5.654L701.713,356.869z M689.525,328.012c0-1.562-0.572-2.925-1.715-4.087s-3.452-1.743-6.928-1.743h-1.611
|
||||
l-1.699,11.719h4.102c2.89,0,4.922-0.61,6.094-1.831S689.525,329.496,689.525,328.012z"/>
|
||||
<path fill="#010101" d="M747.705,316.264l-17.578,18.223l14.912,22.383h-11.807l-14.59-21.65l-3.281,21.65H705.02l6.064-40.605
|
||||
h10.4l-2.578,17.256l16.611-17.256H747.705z"/>
|
||||
<path fill="#010101" d="M780.426,316.264L779.4,323.5h-16.436l-1.26,8.818h14.268l-1.025,7.266h-14.385l-1.377,10.02h19.98
|
||||
l-1.025,7.266h-30.439l5.889-40.605H780.426z"/>
|
||||
<path fill="#010101" d="M823.953,336.156c0,4.512-0.86,8.301-2.578,11.367c-1.719,3.066-4.273,5.391-7.662,6.973
|
||||
s-7.583,2.373-12.582,2.373H782.41l5.83-40.605h14.941c3.534,0,6.625,0.527,9.271,1.582s4.82,2.51,6.52,4.365
|
||||
s2.953,3.97,3.764,6.343S823.953,333.461,823.953,336.156z M813.377,336.303c0-2.031-0.387-4.004-1.158-5.918
|
||||
s-2.192-3.54-4.262-4.878c-2.07-1.338-4.941-2.007-8.613-2.007h-1.67l-3.779,26.104h5.449c2.597,0,4.828-0.391,6.693-1.172
|
||||
s3.33-1.821,4.395-3.12s1.821-2.71,2.271-4.233C813.152,339.555,813.377,337.963,813.377,336.303z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#010101" d="M840.922,305.149l-3.703,26.35c-0.609,4.324-2.72,6.486-6.33,6.486c-0.773,0-1.553-0.07-2.338-0.211
|
||||
l-0.756-3.023c0.879,0.188,1.67,0.281,2.373,0.281c1.219,0,2.118-0.302,2.698-0.905s0.964-1.55,1.151-2.839l3.674-26.139H840.922z
|
||||
"/>
|
||||
<path fill="#010101" d="M857.027,305.8l-0.475,3.357c-1.312-0.867-2.748-1.301-4.307-1.301c-1.312,0-2.361,0.34-3.146,1.02
|
||||
s-1.178,1.576-1.178,2.689c0,0.551,0.188,1.131,0.562,1.74s1.471,1.644,3.287,3.103s3.015,2.739,3.595,3.841
|
||||
s0.87,2.203,0.87,3.305c0,1.758-0.662,3.275-1.986,4.553s-3.088,1.916-5.291,1.916c-1.957,0-3.938-0.586-5.941-1.758l0.51-3.604
|
||||
c2.238,1.559,4.16,2.338,5.766,2.338c0.867,0,1.69-0.284,2.47-0.852c0.779-0.568,1.169-1.339,1.169-2.312
|
||||
c0-0.62-0.197-1.265-0.59-1.933c-0.394-0.667-1.502-1.745-3.324-3.232c-1.824-1.486-3.014-2.778-3.568-3.874
|
||||
c-0.555-1.097-0.832-2.185-0.832-3.263c0-1.899,0.785-3.491,2.355-4.775c1.57-1.283,3.422-1.926,5.555-1.926
|
||||
C854.016,304.833,855.516,305.155,857.027,305.8z"/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path d="M641,234.154c0,2.124-1.722,3.846-3.846,3.846h-5.309c-2.124,0-3.846-1.722-3.846-3.846v-0.309
|
||||
c0-2.124,1.722-3.846,3.846-3.846h5.309c2.124,0,3.846,1.722,3.846,3.846V234.154z"/>
|
||||
<path d="M631.859,249.5c0,1.933-1.1,3.5-2.457,3.5h-12.046c-1.356,0-2.456-1.567-2.456-3.5l0,0c0-1.933,1.1-3.5,2.456-3.5h12.046
|
||||
C630.76,246,631.859,247.567,631.859,249.5L631.859,249.5z"/>
|
||||
<path d="M752.044,231.021c-1.058-3.094-2.692-5.85-4.907-8.269c-2.215-2.418-5.049-4.314-8.498-5.689
|
||||
c-3.45-1.375-7.479-2.063-12.086-2.063h-19.477l-7.6,52.932h24.402c6.518,0,11.984-1.032,16.402-3.094
|
||||
c4.416-2.062,7.746-5.092,9.986-9.09c2.24-3.996,3.361-8.936,3.361-14.817C753.629,237.418,753.1,234.115,752.044,231.021z
|
||||
M738.964,247.347c-0.586,1.986-1.573,3.826-2.96,5.519c-1.389,1.694-3.297,3.049-5.729,4.067s-5.34,1.528-8.727,1.528h-7.103
|
||||
l4.927-34.027h2.176c4.787,0,8.529,0.872,11.229,2.616c2.698,1.744,4.55,3.863,5.557,6.358c1.005,2.494,1.508,5.066,1.508,7.713
|
||||
C739.842,243.286,739.549,245.361,738.964,247.347z"/>
|
||||
<path d="M670.148,234.043l1.373-9.61h21.424l1.337-9.434h-10.601h-24.381h-1.256c-2.124,0-3.846,1.877-3.846,4s1.722,4,3.846,4
|
||||
h0.096h3.793c1.929,0,3.492,1.563,3.492,3.491c0,1.928-1.563,3.491-3.492,3.491h-4.805L657.126,230h-8.983
|
||||
c-1.299,0-2.352,1.786-2.352,3.988c0,2.203,1.053,3.989,2.352,3.989h7.826L655.966,238h3.188c2.124,0,3.846,1.722,3.846,3.846
|
||||
v0.309c0,2.124-1.722,3.846-3.846,3.846h-4.349h-0.96H640.2c-1.933,0-3.5,1.567-3.5,3.5s1.567,3.5,3.5,3.5h8.646h4.945h0.363
|
||||
c2.124,0,3.846,1.722,3.846,3.846v0.309c0,2.124-1.722,3.846-3.846,3.846h-1.523h-3.785h-1.801c-2.124,0-3.846,1.377-3.846,3.5
|
||||
s1.722,3.5,3.846,3.5h25.637c0.272,0,0.537-0.024,0.795-0.068h17.827l1.337-9.471h-26.045l1.795-13.062h18.75l1.337-9.471
|
||||
h-18.599l0.029-0.205C670.055,235.213,670.144,234.647,670.148,234.043z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#010101" d="M642.236,179.15v-33.125l16.988,21.234l16.986-21.234v33.125h16.987v-57.756h-16.987l-16.986,21.234
|
||||
l-16.988-21.234H625.25v57.756H642.236z"/>
|
||||
<path fill="#010101" d="M756.05,150.272h-16.987v-28.878h-16.986v28.878H705.09L730.569,180L756.05,150.272z"/>
|
||||
</g>
|
||||
<path fill="#010101" d="M776,90H606c-11.028,0-20,8.972-20,20v170c0,11.028,8.972,20,20,20h170c11.028,0,20-8.972,20-20V110
|
||||
C796,98.972,787.028,90,776,90z M606,100h170c5.514,0,10,4.486,10,10v83H596v-83C596,104.486,600.486,100,606,100z M776,290H606
|
||||
c-5.514,0-10-4.486-10-10v-82h190v82C786,285.514,781.514,290,776,290z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 11 KiB |
|
@ -1,32 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="300px" height="439.589px" viewBox="100 100 400 400" xml:space="preserve">
|
||||
<g>
|
||||
<g id="Marked_Letters">
|
||||
<path fill="#010101" d="M185.044,358.869h-9.961l-1.143-25.986l-14.092,25.986h-6.24l-6.709-26.807l-8.818,26.807h-10.225 l13.389-40.605h10.928l6.416,25.781l13.916-25.781h10.635L185.044,358.869z"/>
|
||||
<path fill="#010101" d="M226.617,358.869h-10.811l-1.084-8.994H202.33l-4.102,8.994h-10.605l20.566-40.605h10.986L226.617,358.869 z M214.019,344.162l-1.934-15.527l-7.061,15.527H214.019z"/>
|
||||
<path fill="#010101" d="M267.712,358.869h-11.338l-4.043-8.467c-1.191-2.559-2.227-4.478-3.105-5.757s-1.651-2.07-2.314-2.373 c-0.664-0.303-1.553-0.454-2.666-0.454h-1.553l-2.578,17.051h-10.283l5.889-40.605h15.85c5.761,0,9.672,1.27,11.733,3.809 c2.061,2.539,3.091,5.283,3.091,8.232c0,3.105-0.854,5.522-2.563,7.251c-1.709,1.729-4.097,2.798-7.163,3.208 c1.562,0.898,2.769,1.953,3.618,3.164s1.86,3.096,3.032,5.654L267.712,358.869z M255.525,330.012c0-1.562-0.571-2.925-1.714-4.087 s-3.453-1.743-6.929-1.743h-1.611l-1.699,11.719h4.102c2.89,0,4.922-0.61,6.094-1.831S255.525,331.496,255.525,330.012z"/>
|
||||
<path fill="#010101" d="M313.705,318.264l-17.578,18.223l14.912,22.383h-11.807l-14.59-21.65l-3.282,21.65h-10.342l6.064-40.605 h10.401l-2.578,17.256l16.611-17.256H313.705z"/>
|
||||
<path fill="#010101" d="M346.426,318.264L345.4,325.5h-16.436l-1.26,8.818h14.268l-1.025,7.266h-14.385l-1.377,10.02h19.98 l-1.025,7.266h-30.439l5.889-40.605H346.426z"/>
|
||||
<path fill="#010101" d="M389.953,338.156c0,4.512-0.86,8.301-2.578,11.367c-1.719,3.066-4.273,5.391-7.662,6.973 s-7.583,2.373-12.582,2.373H348.41l5.83-40.605h14.941c3.534,0,6.625,0.527,9.271,1.582s4.82,2.51,6.52,4.365 s2.953,3.97,3.764,6.343S389.953,335.461,389.953,338.156z M379.377,338.303c0-2.031-0.387-4.004-1.158-5.918 s-2.192-3.54-4.262-4.878c-2.07-1.338-4.941-2.007-8.613-2.007h-1.67l-3.779,26.104h5.449c2.597,0,4.828-0.391,6.693-1.172 s3.33-1.821,4.395-3.12s1.821-2.71,2.271-4.233C379.152,341.555,379.377,339.963,379.377,338.303z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#010101" d="M406.922,307.149l-3.703,26.35c-0.609,4.324-2.72,6.486-6.33,6.486c-0.773,0-1.553-0.07-2.338-0.211 l-0.756-3.023c0.879,0.188,1.67,0.281,2.373,0.281c1.219,0,2.118-0.302,2.698-0.905s0.964-1.55,1.151-2.839l3.674-26.139H406.922z "/>
|
||||
<path fill="#010101" d="M423.027,307.8l-0.475,3.357c-1.312-0.867-2.748-1.301-4.307-1.301c-1.312,0-2.361,0.34-3.146,1.02 s-1.178,1.576-1.178,2.689c0,0.551,0.188,1.131,0.562,1.74s1.471,1.644,3.287,3.103s3.015,2.739,3.595,3.841 s0.87,2.203,0.87,3.305c0,1.758-0.662,3.275-1.986,4.553s-3.088,1.916-5.291,1.916c-1.957,0-3.938-0.586-5.941-1.758l0.51-3.604 c2.238,1.559,4.16,2.338,5.766,2.338c0.867,0,1.69-0.284,2.47-0.852c0.779-0.568,1.169-1.339,1.169-2.312 c0-0.62-0.197-1.265-0.59-1.933c-0.394-0.667-1.502-1.745-3.324-3.232c-1.824-1.486-3.014-2.778-3.568-3.874 c-0.555-1.097-0.832-2.185-0.832-3.263c0-1.899,0.785-3.491,2.355-4.775c1.57-1.283,3.422-1.926,5.555-1.926 C420.016,306.833,421.516,307.155,423.027,307.8z"/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#010101" d="M357,200v-92c0-8.284-6.716-15-15-15H172c-8.284,0-15,6.716-15,15v92H357z"/>
|
||||
<path fill="#010101" d="M157,205v73c0,8.284,6.716,15,15,15h170c8.284,0,15-6.716,15-15v-73H157z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M208.737,180.15v-33.125l16.987,21.234l16.987-21.234v33.125h16.987v-57.756h-16.987l-16.987,21.234 l-16.987-21.234H191.75v57.756H208.737z"/>
|
||||
<path fill="#FFFFFF" d="M322.55,151.272h-16.987v-28.878h-16.986v28.878h-16.987L297.069,181L322.55,151.272z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M217,241.154c0,2.124-1.722,3.846-3.845,3.846h-5.31c-2.124,0-3.845-1.722-3.845-3.846v-0.309 c0-2.124,1.722-3.846,3.845-3.846h5.31c2.124,0,3.845,1.722,3.845,3.846V241.154z"/>
|
||||
<path fill="#FFFFFF" d="M207.859,256.5c0,1.933-1.1,3.5-2.457,3.5h-12.046c-1.357,0-2.457-1.567-2.457-3.5l0,0 c0-1.933,1.1-3.5,2.457-3.5h12.046C206.759,253,207.859,254.567,207.859,256.5L207.859,256.5z"/>
|
||||
<path fill="#FFFFFF" d="M328.044,238.021c-1.058-3.094-2.692-5.85-4.907-8.269c-2.215-2.418-5.049-4.314-8.498-5.689 c-3.45-1.375-7.479-2.063-12.086-2.063h-19.477l-7.6,52.932h24.403c6.518,0,11.984-1.032,16.402-3.094 c4.416-2.062,7.746-5.092,9.986-9.09c2.24-3.996,3.361-8.936,3.361-14.817C329.629,244.418,329.1,241.115,328.044,238.021z M314.964,254.347c-0.586,1.986-1.573,3.826-2.96,5.519c-1.389,1.694-3.297,3.049-5.729,4.067s-5.34,1.528-8.727,1.528h-7.103 l4.927-34.027h2.176c4.787,0,8.529,0.872,11.229,2.616c2.698,1.744,4.55,3.863,5.557,6.358c1.005,2.494,1.508,5.066,1.508,7.713 C315.842,250.286,315.549,252.361,314.964,254.347z"/>
|
||||
<path fill="#FFFFFF" d="M246.148,241.043l1.373-9.61h21.424l1.336-9.434h-10.601h-24.38h-1.256c-2.125,0-3.846,1.877-3.846,4 s1.721,4,3.846,4h0.096h3.793c1.928,0,3.491,1.563,3.491,3.491c0,1.928-1.563,3.491-3.491,3.491h-4.806L233.126,237h-8.983 c-1.299,0-2.353,1.786-2.353,3.988c0,2.203,1.053,3.989,2.353,3.989h7.826L231.966,245h3.189c2.124,0,3.845,1.722,3.845,3.846 v0.309c0,2.124-1.722,3.846-3.845,3.846h-4.349h-0.96H216.2c-1.933,0-3.5,1.567-3.5,3.5s1.567,3.5,3.5,3.5h8.645h4.945h0.364 c2.124,0,3.845,1.722,3.845,3.846v0.309c0,2.124-1.722,3.846-3.845,3.846h-1.524h-3.785h-1.8c-2.125,0-3.846,1.377-3.846,3.5 s1.721,3.5,3.846,3.5h25.636c0.273,0,0.538-0.024,0.795-0.068h17.828l1.336-9.471h-26.045l1.795-13.062h18.751l1.336-9.471 h-18.598l0.029-0.205C246.055,242.213,246.144,241.647,246.148,241.043z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 5.5 KiB |
|
@ -1,273 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Marked.js Documentation</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
word-wrap: break-word;
|
||||
background: #F9F9F9;
|
||||
}
|
||||
|
||||
#container {
|
||||
max-width: 900px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#content {
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#content h1:first-child {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
nav {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
background: white;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
nav > ul {
|
||||
position: sticky;
|
||||
top: 5px;
|
||||
margin: 10px 0px;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
nav > ul > li {
|
||||
min-width: 125px;
|
||||
padding: 0px 15px;
|
||||
}
|
||||
|
||||
nav > ul > li > ul {
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
nav > ul > li > ul > li {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
nav .selected {
|
||||
color: #111;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
nav .selected:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
header h1 { margin: 0; }
|
||||
|
||||
table {
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
td, th {
|
||||
border: 1px solid #ddd;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0366d6;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: "SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace;
|
||||
padding: 16px;
|
||||
overflow: auto;
|
||||
font-size: 85%;
|
||||
line-height: 1.45;
|
||||
background-color: #f6f8fa;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
code:not([class]) {
|
||||
padding: 0.2em 0.4em;
|
||||
margin: 0;
|
||||
font-size: 85%;
|
||||
background-color: rgba(27,31,35,0.05);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a href="https://github.com/markedjs/marked" class="github-corner" aria-label="View source on Github">
|
||||
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:#202020; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true">
|
||||
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
|
||||
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
|
||||
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
|
||||
</svg>
|
||||
</a>
|
||||
<div id="container">
|
||||
<header>
|
||||
<a href="#/README.md">
|
||||
<img src="img/logo-black.svg" height="64px" width="64px" />
|
||||
</a>
|
||||
<h1>Marked.js Documentation</h1>
|
||||
</header>
|
||||
<div style="display: flex">
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="#/README.md">Getting Started</a>
|
||||
<ul>
|
||||
<li><a href="#/README.md#demo">Demo</a></li>
|
||||
<li><a href="#/README.md#installation">Installation</a></li>
|
||||
<li><a href="#/README.md#usage">Usage</a></li>
|
||||
<li><a href="#/README.md#specifications">Specs</a></li>
|
||||
<li><a href="#/README.md#security">Security</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#/USING_ADVANCED.md">Advanced Usage</a>
|
||||
<ul>
|
||||
<li><a href="#/USING_ADVANCED.md#options">Options</a></li>
|
||||
<li><a href="#/USING_ADVANCED.md#highlight">Highlighting</a></li>
|
||||
<li><a href="#/USING_ADVANCED.md#workers">Workers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#/USING_PRO.md">Extensibility</a>
|
||||
<ul>
|
||||
<li><a href="#/USING_PRO.md#use">marked.use()</a></li>
|
||||
<li><a href="#/USING_PRO.md#renderer">Renderer</a></li>
|
||||
<li><a href="#/USING_PRO.md#tokenizer">Tokenizer</a></li>
|
||||
<li><a href="#/USING_PRO.md#walk-tokens">Walk Tokens</a></li>
|
||||
<li><a href="#/USING_PRO.md#lexer">Lexer</a></li>
|
||||
<li><a href="#/USING_PRO.md#parser">Parser</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#/CONTRIBUTING.md">Contributing</a>
|
||||
<ul>
|
||||
<li><a href="#/CONTRIBUTING.md#design-principles">Design Principles</a></li>
|
||||
<li><a href="#/CONTRIBUTING.md#priorities">Priorities</a></li>
|
||||
<li><a href="#/CONTRIBUTING.md#test-early-often-and-everything">Testing</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
|
||||
<li><a href="#/AUTHORS.md">Authors</a></li>
|
||||
<li><a href="#/PUBLISHING.md">Publishing</a></li>
|
||||
<li><a href="https://github.com/markedjs/marked/blob/master/LICENSE.md">License</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div id="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/unfetch/dist/unfetch.umd.js"></script>
|
||||
<script>
|
||||
if (!window.Promise) {
|
||||
window.Promise = ES6Promise;
|
||||
}
|
||||
if (!window.fetch) {
|
||||
window.fetch = unfetch;
|
||||
}
|
||||
|
||||
var content = document.querySelector('#content');
|
||||
var body = document.querySelector('html');
|
||||
var navLinks = document.querySelectorAll('nav a');
|
||||
var currentPage = 'README.md';
|
||||
var currentHash = '';
|
||||
var renderedPage = '';
|
||||
|
||||
function hashChange() {
|
||||
var hash = location.hash.slice(1);
|
||||
if (!hash) {
|
||||
hash = 'README.md';
|
||||
}
|
||||
|
||||
var uri = hash.split('#');
|
||||
|
||||
if (uri[0].match(/^\//)) {
|
||||
currentPage = uri[0].slice(1);
|
||||
if (uri.length > 1) {
|
||||
currentHash = uri[1];
|
||||
} else {
|
||||
currentHash = '';
|
||||
}
|
||||
} else {
|
||||
currentHash = uri[0];
|
||||
}
|
||||
|
||||
fetchPage(currentPage).then(function () {
|
||||
fetchAnchor(currentHash)
|
||||
});
|
||||
|
||||
var url = '#/' + currentPage + (currentHash ? '#' + currentHash : '');
|
||||
var fullUrl = window.location.origin + '/' + url;
|
||||
|
||||
navLinks.forEach(function(link) {
|
||||
link.className = link.href === fullUrl ? 'selected' : '';
|
||||
});
|
||||
|
||||
history.replaceState('', document.title, url);
|
||||
}
|
||||
|
||||
function fetchAnchor(anchor) {
|
||||
if (!anchor) {
|
||||
return;
|
||||
}
|
||||
|
||||
var hashElement = document.getElementById(anchor);
|
||||
if (hashElement) {
|
||||
hashElement.scrollIntoView();
|
||||
}
|
||||
}
|
||||
|
||||
function fetchPage(page) {
|
||||
if (page === renderedPage) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return fetch(page)
|
||||
.then(function (res) {
|
||||
if (!res.ok) {
|
||||
throw new Error('Error ' + res.status + ': ' + res.statusText);
|
||||
}
|
||||
return res.text();
|
||||
})
|
||||
.then(function (text) {
|
||||
renderedPage = page;
|
||||
content.innerHTML = marked(text);
|
||||
body.scrollTop = 0;
|
||||
}).catch(function (e) {
|
||||
content.innerHTML = '<p>Oops! There was a problem rendering the page.</p>'
|
||||
+ '<p>' + e.message + '</p>';
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('hashchange', function (e) {
|
||||
e.preventDefault();
|
||||
hashChange();
|
||||
});
|
||||
|
||||
hashChange();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -492,12 +492,13 @@ var Tokenizer_1 = class Tokenizer {
|
|||
let raw = cap[0];
|
||||
const bull = cap[2];
|
||||
const isordered = bull.length > 1;
|
||||
const isparen = bull[bull.length - 1] === ')';
|
||||
|
||||
const list = {
|
||||
type: 'list',
|
||||
raw,
|
||||
ordered: isordered,
|
||||
start: isordered ? +bull : '',
|
||||
start: isordered ? +bull.slice(0, -1) : '',
|
||||
loose: false,
|
||||
items: []
|
||||
};
|
||||
|
@ -522,7 +523,7 @@ var Tokenizer_1 = class Tokenizer {
|
|||
// Remove the list item's bullet
|
||||
// so it is seen as the next token.
|
||||
space = item.length;
|
||||
item = item.replace(/^ *([*+-]|\d+\.) */, '');
|
||||
item = item.replace(/^ *([*+-]|\d+[.)]) */, '');
|
||||
|
||||
// Outdent whatever the
|
||||
// list item contains. Hacky.
|
||||
|
@ -537,7 +538,7 @@ var Tokenizer_1 = class Tokenizer {
|
|||
// Backpedal if it does not belong in this list.
|
||||
if (i !== l - 1) {
|
||||
b = this.rules.block.bullet.exec(itemMatch[i + 1])[0];
|
||||
if (bull.length > 1 ? b.length === 1
|
||||
if (isordered ? b.length === 1 || (!isparen && b[b.length - 1] === ')')
|
||||
: (b.length > 1 || (this.options.smartLists && b !== bull))) {
|
||||
addBack = itemMatch.slice(i + 1).join('\n');
|
||||
list.raw = list.raw.substring(0, list.raw.length - addBack.length);
|
||||
|
@ -786,25 +787,49 @@ var Tokenizer_1 = class Tokenizer {
|
|||
}
|
||||
}
|
||||
|
||||
strong(src) {
|
||||
const cap = this.rules.inline.strong.exec(src);
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'strong',
|
||||
raw: cap[0],
|
||||
text: cap[4] || cap[3] || cap[2] || cap[1]
|
||||
};
|
||||
strong(src, maskedSrc, prevChar = '') {
|
||||
let match = this.rules.inline.strong.start.exec(src);
|
||||
|
||||
if (match && (!match[1] || (match[1] && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))))) {
|
||||
maskedSrc = maskedSrc.slice(-1 * src.length);
|
||||
const endReg = match[0] === '**' ? this.rules.inline.strong.endAst : this.rules.inline.strong.endUnd;
|
||||
|
||||
endReg.lastIndex = 0;
|
||||
|
||||
let cap;
|
||||
while ((match = endReg.exec(maskedSrc)) != null) {
|
||||
cap = this.rules.inline.strong.middle.exec(maskedSrc.slice(0, match.index + 3));
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'strong',
|
||||
raw: src.slice(0, cap[0].length),
|
||||
text: src.slice(2, cap[0].length - 2)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
em(src) {
|
||||
const cap = this.rules.inline.em.exec(src);
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'em',
|
||||
raw: cap[0],
|
||||
text: cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1]
|
||||
};
|
||||
em(src, maskedSrc, prevChar = '') {
|
||||
let match = this.rules.inline.em.start.exec(src);
|
||||
|
||||
if (match && (!match[1] || (match[1] && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))))) {
|
||||
maskedSrc = maskedSrc.slice(-1 * src.length);
|
||||
const endReg = match[0] === '*' ? this.rules.inline.em.endAst : this.rules.inline.em.endUnd;
|
||||
|
||||
endReg.lastIndex = 0;
|
||||
|
||||
let cap;
|
||||
while ((match = endReg.exec(maskedSrc)) != null) {
|
||||
cap = this.rules.inline.em.middle.exec(maskedSrc.slice(0, match.index + 2));
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'em',
|
||||
raw: src.slice(0, cap[0].length),
|
||||
text: src.slice(1, cap[0].length - 1)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -950,9 +975,9 @@ const block = {
|
|||
html: '^ {0,3}(?:' // optional indentation
|
||||
+ '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
||||
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
||||
+ '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
|
||||
+ '|<![A-Z][\\s\\S]*?>\\n*' // (4)
|
||||
+ '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*' // (5)
|
||||
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
||||
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
||||
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
||||
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
|
||||
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
|
||||
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
|
||||
|
@ -974,7 +999,7 @@ block.def = edit$1(block.def)
|
|||
.replace('title', block._title)
|
||||
.getRegex();
|
||||
|
||||
block.bullet = /(?:[*+-]|\d{1,9}\.)/;
|
||||
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
||||
block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
|
||||
block.item = edit$1(block.item, 'gm')
|
||||
.replace(/bull/g, block.bullet)
|
||||
|
@ -992,7 +1017,7 @@ block._tag = 'address|article|aside|base|basefont|blockquote|body|caption'
|
|||
+ '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
|
||||
+ '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
|
||||
+ '|track|ul';
|
||||
block._comment = /<!--(?!-?>)[\s\S]*?-->/;
|
||||
block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
||||
block.html = edit$1(block.html, 'i')
|
||||
.replace('comment', block._comment)
|
||||
.replace('tag', block._tag)
|
||||
|
@ -1026,10 +1051,10 @@ block.normal = merge$1({}, block);
|
|||
|
||||
block.gfm = merge$1({}, block.normal, {
|
||||
nptable: '^ *([^|\\n ].*\\|.*)\\n' // Header
|
||||
+ ' *([-:]+ *\\|[-| :]*)' // Align
|
||||
+ ' {0,3}([-:]+ *\\|[-| :]*)' // Align
|
||||
+ '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)', // Cells
|
||||
table: '^ *\\|(.+)\\n' // Header
|
||||
+ ' *\\|?( *[-:]+[-| :]*)' // Align
|
||||
+ ' {0,3}\\|?( *[-:]+[-| :]*)' // Align
|
||||
+ '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
|
||||
});
|
||||
|
||||
|
@ -1100,19 +1125,76 @@ const inline = {
|
|||
link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
|
||||
reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
|
||||
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
|
||||
strong: /^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,
|
||||
em: /^_([^\s_])_(?!_)|^_([^\s_<][\s\S]*?[^\s_])_(?!_|[^\s,punctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\s,punctuation])|^\*([^\s*<\[])\*(?!\*)|^\*([^\s<"][\s\S]*?[^\s\[\*])\*(?![\]`punctuation])|^\*([^\s*"<\[][\s\S]*[^\s])\*(?!\*)/,
|
||||
reflinkSearch: 'reflink|nolink(?!\\()',
|
||||
strong: {
|
||||
start: /^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/, // (1) returns if starts w/ punctuation
|
||||
middle: /^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,
|
||||
endAst: /[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/, // last char can't be punct, or final * must also be followed by punct (or endline)
|
||||
endUnd: /[^\s]__(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
|
||||
},
|
||||
em: {
|
||||
start: /^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/, // (1) returns if starts w/ punctuation
|
||||
middle: /^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,
|
||||
endAst: /[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/, // last char can't be punct, or final * must also be followed by punct (or endline)
|
||||
endUnd: /[^\s]_(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
|
||||
},
|
||||
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
||||
br: /^( {2,}|\\)\n(?!\s*$)/,
|
||||
del: noopTest$1,
|
||||
text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/
|
||||
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n)))/,
|
||||
punctuation: /^([\s*punctuation])/
|
||||
};
|
||||
|
||||
// list of punctuation marks from common mark spec
|
||||
// without ` and ] to workaround Rule 17 (inline code blocks/links)
|
||||
// without , to work around example 393
|
||||
inline._punctuation = '!"#$%&\'()*+\\-./:;<=>?@\\[^_{|}~';
|
||||
inline.em = edit$1(inline.em).replace(/punctuation/g, inline._punctuation).getRegex();
|
||||
// without * and _ to workaround cases with double emphasis
|
||||
inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
|
||||
inline.punctuation = edit$1(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
|
||||
|
||||
// sequences em should skip over [title](link), `code`, <html>
|
||||
inline._blockSkip = '\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>';
|
||||
inline._overlapSkip = '__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*';
|
||||
|
||||
inline._comment = edit$1(block._comment).replace('(?:-->|$)', '-->').getRegex();
|
||||
|
||||
inline.em.start = edit$1(inline.em.start)
|
||||
.replace(/punctuation/g, inline._punctuation)
|
||||
.getRegex();
|
||||
|
||||
inline.em.middle = edit$1(inline.em.middle)
|
||||
.replace(/punctuation/g, inline._punctuation)
|
||||
.replace(/overlapSkip/g, inline._overlapSkip)
|
||||
.getRegex();
|
||||
|
||||
inline.em.endAst = edit$1(inline.em.endAst, 'g')
|
||||
.replace(/punctuation/g, inline._punctuation)
|
||||
.getRegex();
|
||||
|
||||
inline.em.endUnd = edit$1(inline.em.endUnd, 'g')
|
||||
.replace(/punctuation/g, inline._punctuation)
|
||||
.getRegex();
|
||||
|
||||
inline.strong.start = edit$1(inline.strong.start)
|
||||
.replace(/punctuation/g, inline._punctuation)
|
||||
.getRegex();
|
||||
|
||||
inline.strong.middle = edit$1(inline.strong.middle)
|
||||
.replace(/punctuation/g, inline._punctuation)
|
||||
.replace(/blockSkip/g, inline._blockSkip)
|
||||
.getRegex();
|
||||
|
||||
inline.strong.endAst = edit$1(inline.strong.endAst, 'g')
|
||||
.replace(/punctuation/g, inline._punctuation)
|
||||
.getRegex();
|
||||
|
||||
inline.strong.endUnd = edit$1(inline.strong.endUnd, 'g')
|
||||
.replace(/punctuation/g, inline._punctuation)
|
||||
.getRegex();
|
||||
|
||||
inline.blockSkip = edit$1(inline._blockSkip, 'g')
|
||||
.getRegex();
|
||||
|
||||
inline.overlapSkip = edit$1(inline._overlapSkip, 'g')
|
||||
.getRegex();
|
||||
|
||||
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
||||
|
||||
|
@ -1126,7 +1208,7 @@ inline.autolink = edit$1(inline.autolink)
|
|||
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
||||
|
||||
inline.tag = edit$1(inline.tag)
|
||||
.replace('comment', block._comment)
|
||||
.replace('comment', inline._comment)
|
||||
.replace('attribute', inline._attribute)
|
||||
.getRegex();
|
||||
|
||||
|
@ -1144,6 +1226,11 @@ inline.reflink = edit$1(inline.reflink)
|
|||
.replace('label', inline._label)
|
||||
.getRegex();
|
||||
|
||||
inline.reflinkSearch = edit$1(inline.reflinkSearch, 'g')
|
||||
.replace('reflink', inline.reflink)
|
||||
.replace('nolink', inline.nolink)
|
||||
.getRegex();
|
||||
|
||||
/**
|
||||
* Normal Inline Grammar
|
||||
*/
|
||||
|
@ -1155,8 +1242,18 @@ inline.normal = merge$1({}, inline);
|
|||
*/
|
||||
|
||||
inline.pedantic = merge$1({}, inline.normal, {
|
||||
strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
||||
em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
|
||||
strong: {
|
||||
start: /^__|\*\*/,
|
||||
middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
||||
endAst: /\*\*(?!\*)/g,
|
||||
endUnd: /__(?!_)/g
|
||||
},
|
||||
em: {
|
||||
start: /^_|\*/,
|
||||
middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
|
||||
endAst: /\*(?!\*)/g,
|
||||
endUnd: /_(?!_)/g
|
||||
},
|
||||
link: edit$1(/^!?\[(label)\]\((.*?)\)/)
|
||||
.replace('label', inline._label)
|
||||
.getRegex(),
|
||||
|
@ -1175,7 +1272,7 @@ inline.gfm = merge$1({}, inline.normal, {
|
|||
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
||||
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
|
||||
del: /^~+(?=\S)([\s\S]*?\S)~+/,
|
||||
text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
|
||||
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
|
||||
});
|
||||
|
||||
inline.gfm.url = edit$1(inline.gfm.url, 'i')
|
||||
|
@ -1515,9 +1612,29 @@ var Lexer_1 = class Lexer {
|
|||
/**
|
||||
* Lexing/Compiling
|
||||
*/
|
||||
inlineTokens(src, tokens = [], inLink = false, inRawBlock = false) {
|
||||
inlineTokens(src, tokens = [], inLink = false, inRawBlock = false, prevChar = '') {
|
||||
let token;
|
||||
|
||||
// String with links masked to avoid interference with em and strong
|
||||
let maskedSrc = src;
|
||||
let match;
|
||||
|
||||
// Mask out reflinks
|
||||
if (this.tokens.links) {
|
||||
const links = Object.keys(this.tokens.links);
|
||||
if (links.length > 0) {
|
||||
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
||||
if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
|
||||
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Mask out other blocks
|
||||
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
||||
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
||||
}
|
||||
|
||||
while (src) {
|
||||
// escape
|
||||
if (token = this.tokenizer.escape(src)) {
|
||||
|
@ -1556,7 +1673,7 @@ var Lexer_1 = class Lexer {
|
|||
}
|
||||
|
||||
// strong
|
||||
if (token = this.tokenizer.strong(src)) {
|
||||
if (token = this.tokenizer.strong(src, maskedSrc, prevChar)) {
|
||||
src = src.substring(token.raw.length);
|
||||
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
|
||||
tokens.push(token);
|
||||
|
@ -1564,7 +1681,7 @@ var Lexer_1 = class Lexer {
|
|||
}
|
||||
|
||||
// em
|
||||
if (token = this.tokenizer.em(src)) {
|
||||
if (token = this.tokenizer.em(src, maskedSrc, prevChar)) {
|
||||
src = src.substring(token.raw.length);
|
||||
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
|
||||
tokens.push(token);
|
||||
|
@ -1610,6 +1727,7 @@ var Lexer_1 = class Lexer {
|
|||
// text
|
||||
if (token = this.tokenizer.inlineText(src, inRawBlock, smartypants)) {
|
||||
src = src.substring(token.raw.length);
|
||||
prevChar = token.raw.slice(-1);
|
||||
tokens.push(token);
|
||||
continue;
|
||||
}
|
||||
|
@ -1845,11 +1963,8 @@ var Slugger_1 = class Slugger {
|
|||
this.seen = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert string to unique id
|
||||
*/
|
||||
slug(value) {
|
||||
let slug = value
|
||||
serialize(value) {
|
||||
return value
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
// remove html tags
|
||||
|
@ -1857,18 +1972,37 @@ var Slugger_1 = class Slugger {
|
|||
// remove unwanted chars
|
||||
.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
|
||||
.replace(/\s/g, '-');
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the next safe (unique) slug to use
|
||||
*/
|
||||
getNextSafeSlug(originalSlug, isDryRun) {
|
||||
let slug = originalSlug;
|
||||
let occurenceAccumulator = 0;
|
||||
if (this.seen.hasOwnProperty(slug)) {
|
||||
const originalSlug = slug;
|
||||
occurenceAccumulator = this.seen[originalSlug];
|
||||
do {
|
||||
this.seen[originalSlug]++;
|
||||
slug = originalSlug + '-' + this.seen[originalSlug];
|
||||
occurenceAccumulator++;
|
||||
slug = originalSlug + '-' + occurenceAccumulator;
|
||||
} while (this.seen.hasOwnProperty(slug));
|
||||
}
|
||||
this.seen[slug] = 0;
|
||||
|
||||
if (!isDryRun) {
|
||||
this.seen[originalSlug] = occurenceAccumulator;
|
||||
this.seen[slug] = 0;
|
||||
}
|
||||
return slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert string to unique id
|
||||
* @param {object} options
|
||||
* @param {boolean} options.dryrun Generates the next unique slug without updating the internal accumulator.
|
||||
*/
|
||||
slug(value, options = {}) {
|
||||
const slug = this.serialize(value);
|
||||
return this.getNextSafeSlug(slug, options.dryrun);
|
||||
}
|
||||
};
|
||||
|
||||
const { defaults: defaults$4 } = defaults;
|
||||
|
|
|
@ -48,24 +48,29 @@
|
|||
return arr2;
|
||||
}
|
||||
|
||||
function _createForOfIteratorHelperLoose(o) {
|
||||
var i = 0;
|
||||
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
||||
var it;
|
||||
|
||||
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
||||
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) return function () {
|
||||
if (i >= o.length) return {
|
||||
done: true
|
||||
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
||||
if (it) o = it;
|
||||
var i = 0;
|
||||
return function () {
|
||||
if (i >= o.length) return {
|
||||
done: true
|
||||
};
|
||||
return {
|
||||
done: false,
|
||||
value: o[i++]
|
||||
};
|
||||
};
|
||||
return {
|
||||
done: false,
|
||||
value: o[i++]
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
}
|
||||
|
||||
i = o[Symbol.iterator]();
|
||||
return i.next.bind(i);
|
||||
it = o[Symbol.iterator]();
|
||||
return it.next.bind(it);
|
||||
}
|
||||
|
||||
function createCommonjsModule(fn, module) {
|
||||
|
@ -585,11 +590,12 @@
|
|||
var raw = cap[0];
|
||||
var bull = cap[2];
|
||||
var isordered = bull.length > 1;
|
||||
var isparen = bull[bull.length - 1] === ')';
|
||||
var list = {
|
||||
type: 'list',
|
||||
raw: raw,
|
||||
ordered: isordered,
|
||||
start: isordered ? +bull : '',
|
||||
start: isordered ? +bull.slice(0, -1) : '',
|
||||
loose: false,
|
||||
items: []
|
||||
}; // Get each top-level item.
|
||||
|
@ -611,7 +617,7 @@
|
|||
// so it is seen as the next token.
|
||||
|
||||
space = item.length;
|
||||
item = item.replace(/^ *([*+-]|\d+\.) */, ''); // Outdent whatever the
|
||||
item = item.replace(/^ *([*+-]|\d+[.)]) */, ''); // Outdent whatever the
|
||||
// list item contains. Hacky.
|
||||
|
||||
if (~item.indexOf('\n ')) {
|
||||
|
@ -624,7 +630,7 @@
|
|||
if (i !== l - 1) {
|
||||
b = this.rules.block.bullet.exec(itemMatch[i + 1])[0];
|
||||
|
||||
if (bull.length > 1 ? b.length === 1 : b.length > 1 || this.options.smartLists && b !== bull) {
|
||||
if (isordered ? b.length === 1 || !isparen && b[b.length - 1] === ')' : b.length > 1 || this.options.smartLists && b !== bull) {
|
||||
addBack = itemMatch.slice(i + 1).join('\n');
|
||||
list.raw = list.raw.substring(0, list.raw.length - addBack.length);
|
||||
i = l - 1;
|
||||
|
@ -879,27 +885,57 @@
|
|||
}
|
||||
};
|
||||
|
||||
_proto.strong = function strong(src) {
|
||||
var cap = this.rules.inline.strong.exec(src);
|
||||
_proto.strong = function strong(src, maskedSrc, prevChar) {
|
||||
if (prevChar === void 0) {
|
||||
prevChar = '';
|
||||
}
|
||||
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'strong',
|
||||
raw: cap[0],
|
||||
text: cap[4] || cap[3] || cap[2] || cap[1]
|
||||
};
|
||||
var match = this.rules.inline.strong.start.exec(src);
|
||||
|
||||
if (match && (!match[1] || match[1] && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar)))) {
|
||||
maskedSrc = maskedSrc.slice(-1 * src.length);
|
||||
var endReg = match[0] === '**' ? this.rules.inline.strong.endAst : this.rules.inline.strong.endUnd;
|
||||
endReg.lastIndex = 0;
|
||||
var cap;
|
||||
|
||||
while ((match = endReg.exec(maskedSrc)) != null) {
|
||||
cap = this.rules.inline.strong.middle.exec(maskedSrc.slice(0, match.index + 3));
|
||||
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'strong',
|
||||
raw: src.slice(0, cap[0].length),
|
||||
text: src.slice(2, cap[0].length - 2)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_proto.em = function em(src) {
|
||||
var cap = this.rules.inline.em.exec(src);
|
||||
_proto.em = function em(src, maskedSrc, prevChar) {
|
||||
if (prevChar === void 0) {
|
||||
prevChar = '';
|
||||
}
|
||||
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'em',
|
||||
raw: cap[0],
|
||||
text: cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1]
|
||||
};
|
||||
var match = this.rules.inline.em.start.exec(src);
|
||||
|
||||
if (match && (!match[1] || match[1] && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar)))) {
|
||||
maskedSrc = maskedSrc.slice(-1 * src.length);
|
||||
var endReg = match[0] === '*' ? this.rules.inline.em.endAst : this.rules.inline.em.endUnd;
|
||||
endReg.lastIndex = 0;
|
||||
var cap;
|
||||
|
||||
while ((match = endReg.exec(maskedSrc)) != null) {
|
||||
cap = this.rules.inline.em.middle.exec(maskedSrc.slice(0, match.index + 2));
|
||||
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'em',
|
||||
raw: src.slice(0, cap[0].length),
|
||||
text: src.slice(1, cap[0].length - 1)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1057,9 +1093,9 @@
|
|||
html: '^ {0,3}(?:' // optional indentation
|
||||
+ '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
||||
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
||||
+ '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
|
||||
+ '|<![A-Z][\\s\\S]*?>\\n*' // (4)
|
||||
+ '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*' // (5)
|
||||
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
||||
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
||||
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
||||
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
|
||||
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
|
||||
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
|
||||
|
@ -1076,12 +1112,12 @@
|
|||
block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
|
||||
block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
||||
block.def = edit$1(block.def).replace('label', block._label).replace('title', block._title).getRegex();
|
||||
block.bullet = /(?:[*+-]|\d{1,9}\.)/;
|
||||
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
||||
block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
|
||||
block.item = edit$1(block.item, 'gm').replace(/bull/g, block.bullet).getRegex();
|
||||
block.list = edit$1(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
|
||||
block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
|
||||
block._comment = /<!--(?!-?>)[\s\S]*?-->/;
|
||||
block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
||||
block.html = edit$1(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
||||
block.paragraph = edit$1(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
|
||||
.replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
||||
|
@ -1099,11 +1135,11 @@
|
|||
|
||||
block.gfm = merge$1({}, block.normal, {
|
||||
nptable: '^ *([^|\\n ].*\\|.*)\\n' // Header
|
||||
+ ' *([-:]+ *\\|[-| :]*)' // Align
|
||||
+ ' {0,3}([-:]+ *\\|[-| :]*)' // Align
|
||||
+ '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)',
|
||||
// Cells
|
||||
table: '^ *\\|(.+)\\n' // Header
|
||||
+ ' *\\|?( *[-:]+[-| :]*)' // Align
|
||||
+ ' {0,3}\\|?( *[-:]+[-| :]*)' // Align
|
||||
+ '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
|
||||
|
||||
});
|
||||
|
@ -1143,29 +1179,61 @@
|
|||
link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
|
||||
reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
|
||||
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
|
||||
strong: /^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,
|
||||
em: /^_([^\s_])_(?!_)|^_([^\s_<][\s\S]*?[^\s_])_(?!_|[^\s,punctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\s,punctuation])|^\*([^\s*<\[])\*(?!\*)|^\*([^\s<"][\s\S]*?[^\s\[\*])\*(?![\]`punctuation])|^\*([^\s*"<\[][\s\S]*[^\s])\*(?!\*)/,
|
||||
reflinkSearch: 'reflink|nolink(?!\\()',
|
||||
strong: {
|
||||
start: /^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,
|
||||
// (1) returns if starts w/ punctuation
|
||||
middle: /^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,
|
||||
endAst: /[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,
|
||||
// last char can't be punct, or final * must also be followed by punct (or endline)
|
||||
endUnd: /[^\s]__(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
|
||||
|
||||
},
|
||||
em: {
|
||||
start: /^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,
|
||||
// (1) returns if starts w/ punctuation
|
||||
middle: /^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,
|
||||
endAst: /[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,
|
||||
// last char can't be punct, or final * must also be followed by punct (or endline)
|
||||
endUnd: /[^\s]_(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
|
||||
|
||||
},
|
||||
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
||||
br: /^( {2,}|\\)\n(?!\s*$)/,
|
||||
del: noopTest$1,
|
||||
text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/
|
||||
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n)))/,
|
||||
punctuation: /^([\s*punctuation])/
|
||||
}; // list of punctuation marks from common mark spec
|
||||
// without ` and ] to workaround Rule 17 (inline code blocks/links)
|
||||
// without , to work around example 393
|
||||
// without * and _ to workaround cases with double emphasis
|
||||
|
||||
inline._punctuation = '!"#$%&\'()*+\\-./:;<=>?@\\[^_{|}~';
|
||||
inline.em = edit$1(inline.em).replace(/punctuation/g, inline._punctuation).getRegex();
|
||||
inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
|
||||
inline.punctuation = edit$1(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex(); // sequences em should skip over [title](link), `code`, <html>
|
||||
|
||||
inline._blockSkip = '\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>';
|
||||
inline._overlapSkip = '__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*';
|
||||
inline._comment = edit$1(block._comment).replace('(?:-->|$)', '-->').getRegex();
|
||||
inline.em.start = edit$1(inline.em.start).replace(/punctuation/g, inline._punctuation).getRegex();
|
||||
inline.em.middle = edit$1(inline.em.middle).replace(/punctuation/g, inline._punctuation).replace(/overlapSkip/g, inline._overlapSkip).getRegex();
|
||||
inline.em.endAst = edit$1(inline.em.endAst, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
|
||||
inline.em.endUnd = edit$1(inline.em.endUnd, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
|
||||
inline.strong.start = edit$1(inline.strong.start).replace(/punctuation/g, inline._punctuation).getRegex();
|
||||
inline.strong.middle = edit$1(inline.strong.middle).replace(/punctuation/g, inline._punctuation).replace(/blockSkip/g, inline._blockSkip).getRegex();
|
||||
inline.strong.endAst = edit$1(inline.strong.endAst, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
|
||||
inline.strong.endUnd = edit$1(inline.strong.endUnd, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
|
||||
inline.blockSkip = edit$1(inline._blockSkip, 'g').getRegex();
|
||||
inline.overlapSkip = edit$1(inline._overlapSkip, 'g').getRegex();
|
||||
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
||||
inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
||||
inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
|
||||
inline.autolink = edit$1(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
|
||||
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
||||
inline.tag = edit$1(inline.tag).replace('comment', block._comment).replace('attribute', inline._attribute).getRegex();
|
||||
inline.tag = edit$1(inline.tag).replace('comment', inline._comment).replace('attribute', inline._attribute).getRegex();
|
||||
inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
||||
inline._href = /<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/;
|
||||
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
||||
inline.link = edit$1(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
|
||||
inline.reflink = edit$1(inline.reflink).replace('label', inline._label).getRegex();
|
||||
inline.reflinkSearch = edit$1(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
|
||||
/**
|
||||
* Normal Inline Grammar
|
||||
*/
|
||||
|
@ -1176,8 +1244,18 @@
|
|||
*/
|
||||
|
||||
inline.pedantic = merge$1({}, inline.normal, {
|
||||
strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
||||
em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,
|
||||
strong: {
|
||||
start: /^__|\*\*/,
|
||||
middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
||||
endAst: /\*\*(?!\*)/g,
|
||||
endUnd: /__(?!_)/g
|
||||
},
|
||||
em: {
|
||||
start: /^_|\*/,
|
||||
middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
|
||||
endAst: /\*(?!\*)/g,
|
||||
endUnd: /_(?!_)/g
|
||||
},
|
||||
link: edit$1(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
|
||||
reflink: edit$1(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
|
||||
});
|
||||
|
@ -1191,7 +1269,7 @@
|
|||
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
||||
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
|
||||
del: /^~+(?=\S)([\s\S]*?\S)~+/,
|
||||
text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
|
||||
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
|
||||
});
|
||||
inline.gfm.url = edit$1(inline.gfm.url, 'i').replace('email', inline.gfm._extended_email).getRegex();
|
||||
/**
|
||||
|
@ -1543,7 +1621,7 @@
|
|||
*/
|
||||
;
|
||||
|
||||
_proto.inlineTokens = function inlineTokens(src, tokens, inLink, inRawBlock) {
|
||||
_proto.inlineTokens = function inlineTokens(src, tokens, inLink, inRawBlock, prevChar) {
|
||||
if (tokens === void 0) {
|
||||
tokens = [];
|
||||
}
|
||||
|
@ -1556,7 +1634,31 @@
|
|||
inRawBlock = false;
|
||||
}
|
||||
|
||||
var token;
|
||||
if (prevChar === void 0) {
|
||||
prevChar = '';
|
||||
}
|
||||
|
||||
var token; // String with links masked to avoid interference with em and strong
|
||||
|
||||
var maskedSrc = src;
|
||||
var match; // Mask out reflinks
|
||||
|
||||
if (this.tokens.links) {
|
||||
var links = Object.keys(this.tokens.links);
|
||||
|
||||
if (links.length > 0) {
|
||||
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
||||
if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
|
||||
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // Mask out other blocks
|
||||
|
||||
|
||||
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
||||
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
||||
}
|
||||
|
||||
while (src) {
|
||||
// escape
|
||||
|
@ -1600,7 +1702,7 @@
|
|||
} // strong
|
||||
|
||||
|
||||
if (token = this.tokenizer.strong(src)) {
|
||||
if (token = this.tokenizer.strong(src, maskedSrc, prevChar)) {
|
||||
src = src.substring(token.raw.length);
|
||||
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
|
||||
tokens.push(token);
|
||||
|
@ -1608,7 +1710,7 @@
|
|||
} // em
|
||||
|
||||
|
||||
if (token = this.tokenizer.em(src)) {
|
||||
if (token = this.tokenizer.em(src, maskedSrc, prevChar)) {
|
||||
src = src.substring(token.raw.length);
|
||||
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
|
||||
tokens.push(token);
|
||||
|
@ -1654,6 +1756,7 @@
|
|||
|
||||
if (token = this.tokenizer.inlineText(src, inRawBlock, smartypants)) {
|
||||
src = src.substring(token.raw.length);
|
||||
prevChar = token.raw.slice(-1);
|
||||
tokens.push(token);
|
||||
continue;
|
||||
}
|
||||
|
@ -1891,29 +1994,53 @@
|
|||
function Slugger() {
|
||||
this.seen = {};
|
||||
}
|
||||
/**
|
||||
* Convert string to unique id
|
||||
*/
|
||||
|
||||
|
||||
var _proto = Slugger.prototype;
|
||||
|
||||
_proto.slug = function slug(value) {
|
||||
var slug = value.toLowerCase().trim() // remove html tags
|
||||
_proto.serialize = function serialize(value) {
|
||||
return value.toLowerCase().trim() // remove html tags
|
||||
.replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars
|
||||
.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
|
||||
}
|
||||
/**
|
||||
* Finds the next safe (unique) slug to use
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) {
|
||||
var slug = originalSlug;
|
||||
var occurenceAccumulator = 0;
|
||||
|
||||
if (this.seen.hasOwnProperty(slug)) {
|
||||
var originalSlug = slug;
|
||||
occurenceAccumulator = this.seen[originalSlug];
|
||||
|
||||
do {
|
||||
this.seen[originalSlug]++;
|
||||
slug = originalSlug + '-' + this.seen[originalSlug];
|
||||
occurenceAccumulator++;
|
||||
slug = originalSlug + '-' + occurenceAccumulator;
|
||||
} while (this.seen.hasOwnProperty(slug));
|
||||
}
|
||||
|
||||
this.seen[slug] = 0;
|
||||
if (!isDryRun) {
|
||||
this.seen[originalSlug] = occurenceAccumulator;
|
||||
this.seen[slug] = 0;
|
||||
}
|
||||
|
||||
return slug;
|
||||
}
|
||||
/**
|
||||
* Convert string to unique id
|
||||
* @param {object} options
|
||||
* @param {boolean} options.dryrun Generates the next unique slug without updating the internal accumulator.
|
||||
*/
|
||||
;
|
||||
|
||||
_proto.slug = function slug(value, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
var slug = this.serialize(value);
|
||||
return this.getNextSafeSlug(slug, options.dryrun);
|
||||
};
|
||||
|
||||
return Slugger;
|
||||
|
|
1966
packages/markdown/marked/package-lock.json
generated
1966
packages/markdown/marked/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -2,7 +2,7 @@
|
|||
"name": "marked",
|
||||
"description": "A markdown parser built for speed",
|
||||
"author": "Christopher Jeffrey",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"main": "./src/marked.js",
|
||||
"browser": "./lib/marked.js",
|
||||
"bin": "./bin/marked",
|
||||
|
@ -31,27 +31,29 @@
|
|||
"html"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.9.6",
|
||||
"@babel/preset-env": "^7.9.6",
|
||||
"@babel/core": "^7.10.4",
|
||||
"@babel/preset-env": "^7.10.4",
|
||||
"@markedjs/html-differ": "^3.0.2",
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"commonmark": "0.29.x",
|
||||
"eslint": "^7.0.0",
|
||||
"commonmark": "0.29.1",
|
||||
"eslint": "^7.4.0",
|
||||
"eslint-config-standard": "^14.1.1",
|
||||
"eslint-plugin-import": "^2.20.2",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint-plugin-standard": "^4.0.1",
|
||||
"front-matter": "^3.2.1",
|
||||
"front-matter": "^4.0.2",
|
||||
"highlight.js": "^10.1.2",
|
||||
"jasmine": "^3.5.0",
|
||||
"markdown": "0.5.x",
|
||||
"markdown-it": "10.x",
|
||||
"markdown-it": "11.x",
|
||||
"node-fetch": "^2.6.0",
|
||||
"rollup": "^2.10.2",
|
||||
"rollup": "^2.21.0",
|
||||
"rollup-plugin-babel": "^4.4.0",
|
||||
"rollup-plugin-commonjs": "^10.1.0",
|
||||
"rollup-plugin-license": "^2.0.1",
|
||||
"uglify-js": "^3.9.3",
|
||||
"rollup-plugin-license": "^2.1.0",
|
||||
"titleize": "^2.1.0",
|
||||
"uglify-js": "^3.10.0",
|
||||
"vuln-regex-detector": "^1.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
|
@ -62,10 +64,12 @@
|
|||
"test:lint": "eslint bin/marked .",
|
||||
"test:redos": "node test/vuln-regex.js",
|
||||
"test:update": "node test/update-specs.js",
|
||||
"rules": "node test/rules.js",
|
||||
"bench": "npm run rollup && node test/bench.js",
|
||||
"lint": "eslint --fix bin/marked .",
|
||||
"build:reset": "git checkout upstream/master lib/marked.js lib/marked.esm.js marked.min.js",
|
||||
"build": "npm run rollup && npm run minify",
|
||||
"build:docs": "node build-docs.js",
|
||||
"rollup": "npm run rollup:umd && npm run rollup:esm",
|
||||
"rollup:umd": "rollup -c rollup.config.js",
|
||||
"rollup:esm": "rollup -c rollup.config.esm.js",
|
||||
|
@ -74,8 +78,5 @@
|
|||
},
|
||||
"engines": {
|
||||
"node": ">= 8.16.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.19"
|
||||
}
|
||||
}
|
||||
|
|
0
packages/markdown/package.js
Executable file → Normal file
0
packages/markdown/package.js
Executable file → Normal file
0
packages/markdown/smart.json
Executable file → Normal file
0
packages/markdown/smart.json
Executable file → Normal file
|
@ -1,5 +1,5 @@
|
|||
import { checkNpmVersions } from 'meteor/tmeasday:check-npm-versions';
|
||||
|
||||
checkNpmVersions({
|
||||
'xss': '1.0.6',
|
||||
'xss': '1.0.8',
|
||||
}, 'my:xss');
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
Meteor.startup(() => {
|
||||
// Mouse Scroll Intertia, issue #2949. Integer.
|
||||
if (process.env.SCROLLINERTIA !== '0') {
|
||||
Meteor.settings.public.SCROLLINERTIA = process.env.SCROLLINERTIA;
|
||||
} else {
|
||||
Meteor.settings.public.SCROLLINERTIA = 0;
|
||||
}
|
||||
// Mouse Scroll Intertia, issue #2949. Integer.
|
||||
if (process.env.SCROLLINERTIA !== '0') {
|
||||
Meteor.settings.public.SCROLLINERTIA = process.env.SCROLLINERTIA;
|
||||
} else {
|
||||
Meteor.settings.public.SCROLLINERTIA = 0;
|
||||
}
|
||||
|
||||
// Mouse Scroll Amount, issue #2949. "auto" or Integer.
|
||||
if (process.env.SCROLLAMOUNT !== 'auto') {
|
||||
Meteor.settings.public.SCROLLAMOUNT = process.env.SCROLLAMOUNT;
|
||||
} else {
|
||||
Meteor.settings.public.SCROLLAMOUNT = 'auto';
|
||||
}
|
||||
// Mouse Scroll Amount, issue #2949. "auto" or Integer.
|
||||
if (process.env.SCROLLAMOUNT !== 'auto') {
|
||||
Meteor.settings.public.SCROLLAMOUNT = process.env.SCROLLAMOUNT;
|
||||
} else {
|
||||
Meteor.settings.public.SCROLLAMOUNT = 'auto';
|
||||
}
|
||||
|
||||
// Mouse Scroll DeltaFactor, issue #2949. "auto" or Integer.
|
||||
if (process.env.SCROLLDELTAFACTOR !== 'auto') {
|
||||
Meteor.settings.public.SCROLLDELTAFACTOR = process.env.SCROLLDELTAFACTOR;
|
||||
} else {
|
||||
Meteor.settings.public.SCROLLDELTAFACTOR = 'auto';
|
||||
}
|
||||
|
||||
});
|
||||
// Mouse Scroll DeltaFactor, issue #2949. "auto" or Integer.
|
||||
if (process.env.SCROLLDELTAFACTOR !== 'auto') {
|
||||
Meteor.settings.public.SCROLLDELTAFACTOR = process.env.SCROLLDELTAFACTOR;
|
||||
} else {
|
||||
Meteor.settings.public.SCROLLDELTAFACTOR = 'auto';
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue