pax_global_header 0000666 0000000 0000000 00000000064 15263151172 0014515 g ustar 00root root 0000000 0000000 52 comment=cdbdc0122ab83b2b97560944bf009a22cfb78b05
markedjs-marked-cdbdc01/ 0000775 0000000 0000000 00000000000 15263151172 0015320 5 ustar 00root root 0000000 0000000 markedjs-marked-cdbdc01/.devcontainer/ 0000775 0000000 0000000 00000000000 15263151172 0020057 5 ustar 00root root 0000000 0000000 markedjs-marked-cdbdc01/.devcontainer/devcontainer.json 0000664 0000000 0000000 00000001116 15263151172 0023432 0 ustar 00root root 0000000 0000000 // For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "marked",
// We're using node 14 for development, to keep close to the engine compatibility that marked.js uses.
"image": "mcr.microsoft.com/devcontainers/javascript-node:0-14",
"postCreateCommand": "npm install",
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"extensions": [
"dbaeumeur.vscode-eslint"
]
}
}
}
markedjs-marked-cdbdc01/.editorconfig 0000664 0000000 0000000 00000000420 15263151172 0017771 0 ustar 00root root 0000000 0000000 root = true
[*.{json,js}]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
[*.md, !test/*.md]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4 markedjs-marked-cdbdc01/.gitattributes 0000664 0000000 0000000 00000000114 15263151172 0020207 0 ustar 00root root 0000000 0000000 * eol=lf
test/* linguist-vendored
lib/* linguist-generated
markedjs-marked-cdbdc01/.github/ 0000775 0000000 0000000 00000000000 15263151172 0016660 5 ustar 00root root 0000000 0000000 markedjs-marked-cdbdc01/.github/ISSUE_TEMPLATE.md 0000664 0000000 0000000 00000001753 15263151172 0021373 0 ustar 00root root 0000000 0000000 **Marked version:**
**Markdown flavor:** Markdown.pl|CommonMark|GitHub Flavored Markdown|n/a
## Expectation
**CommonMark Demo:** [demo](https://spec.commonmark.org/dingus/)
## Result
**Marked Demo:** [demo](https://marked.js.org/demo/)
## What was attempted
markedjs-marked-cdbdc01/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 15263151172 0021043 5 ustar 00root root 0000000 0000000 markedjs-marked-cdbdc01/.github/ISSUE_TEMPLATE/Bug_report.md 0000664 0000000 0000000 00000001541 15263151172 0023476 0 ustar 00root root 0000000 0000000 ---
name: Bug report
about: Marked says it does this thing but does not
---
**Marked version:**
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
**Expected behavior**
A clear and concise description of what you expected to happen.
markedjs-marked-cdbdc01/.github/ISSUE_TEMPLATE/Feature_request.md 0000664 0000000 0000000 00000000600 15263151172 0024524 0 ustar 00root root 0000000 0000000 ---
name: Feature request
about: Marked doesn't do this thing and I think it should
---
**Describe the feature**
A clear and concise description of what you would like.
**Why is this feature necessary?**
A clear and concise description of why.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
markedjs-marked-cdbdc01/.github/ISSUE_TEMPLATE/Proposal.md 0000664 0000000 0000000 00000000473 15263151172 0023170 0 ustar 00root root 0000000 0000000 ---
name: Proposal
about: Marked doesn't do this thing and I think it should
---
**What pain point are you perceiving?.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
markedjs-marked-cdbdc01/.github/PULL_REQUEST_TEMPLATE.md 0000664 0000000 0000000 00000002517 15263151172 0022466 0 ustar 00root root 0000000 0000000
**Marked version:**
**Markdown flavor:** Markdown.pl|CommonMark|GitHub Flavored Markdown|n/a
## Description
- Fixes #### (if fixing a known issue; otherwise, describe issue using the following format)
## Contributor
- [ ] Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
- [ ] no tests required for this PR.
- [ ] If submitting new feature, it has been documented in the appropriate places.
## Committer
In most cases, this should be a different person than the contributor.
- [ ] CI is green (no forced merge required).
- [ ] Squash and Merge PR following [conventional commit guidelines](https://www.conventionalcommits.org/).
markedjs-marked-cdbdc01/.github/PULL_REQUEST_TEMPLATE/ 0000775 0000000 0000000 00000000000 15263151172 0022137 5 ustar 00root root 0000000 0000000 markedjs-marked-cdbdc01/.github/PULL_REQUEST_TEMPLATE/badges.md 0000664 0000000 0000000 00000006422 15263151172 0023712 0 ustar 00root root 0000000 0000000 **@mention the contributor:**
## Recommendation to:
- [ ] Change user group
- [ ] Add a badge
- [ ] Remove a badge
## As the one mentioned, I would like to:
- [ ] accept the recommendation; or,
- [ ] graciously decline; or,
- [ ] dispute the recommendation
within 30 days, if you have not indicated which option you are taking one of the following will happen:
1. If adding a badge, we will assume you are graciously declining.
2. If removing a badge, we will assume you do not want to dispute the recommendation; therefore, the badge will be removed.
Note: All committers must approve via review before merging, the disapproving committer can simply close the PR.
markedjs-marked-cdbdc01/.github/dependabot.yml 0000664 0000000 0000000 00000000361 15263151172 0021510 0 ustar 00root root 0000000 0000000 version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
versioning-strategy: "increase"
directory: "/"
schedule:
interval: "weekly"
markedjs-marked-cdbdc01/.github/workflows/ 0000775 0000000 0000000 00000000000 15263151172 0020715 5 ustar 00root root 0000000 0000000 markedjs-marked-cdbdc01/.github/workflows/tests.yml 0000664 0000000 0000000 00000005416 15263151172 0022610 0 ustar 00root root 0000000 0000000 name: "Tests"
on:
pull_request:
push:
branches:
- master
permissions:
contents: read
jobs:
UnitTests:
strategy:
matrix:
# lowest version here should also be in `engines` field
node_version: [20, "lts/*", "latest"]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Install Node
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node_version }}
check-latest: true
- name: Install Dependencies
run: npm ci
- name: Build ποΈ
run: npm run build
- name: Run Unit Tests π©π½βπ»
run: npm run test:unit
- name: Run Spec Tests π©π½βπ»
run: npm run test:specs
- name: Run CJS Tests π©π½βπ»
run: npm run test:cjs
OtherTests:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Install Node
uses: actions/setup-node@v7
with:
node-version: "lts/*"
- name: Install Dependencies
run: npm ci
- name: Build ποΈ
run: npm run build
- name: Run UMD Tests π©π½βπ»
run: npm run test:umd
- name: Run Types Tests π©π½βπ»
run: npm run test:types
- name: Lint β¨
run: npm run test:lint
Release:
permissions:
contents: write # to be able to publish a GitHub release
# issues: write # to be able to comment on released issues
# pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for trusted publishing and npm provenance
needs: [UnitTests, OtherTests]
if: |
github.ref == 'refs/heads/master' &&
github.event.repository.fork == false
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Install Node
uses: actions/setup-node@v7
with:
node-version: "lts/*"
- name: Install Dependencies
run: npm ci
- name: Build ποΈ
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export SEMANTIC_RELEASE_NEXT_VERSION=$(npx semantic-release --no-ci --dry-run | grep -oP 'The next release version is \K[0-9]+\.[0-9]+\.[0-9]+')
echo "Next Version: $SEMANTIC_RELEASE_NEXT_VERSION"
npm run build
if ! git diff --quiet; then
git config --global user.email "<>"
git config --global user.name "MarkedJS bot"
git commit -am "ποΈ build v$SEMANTIC_RELEASE_NEXT_VERSION [skip ci]"
fi
- name: Release π
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
markedjs-marked-cdbdc01/.gitignore 0000664 0000000 0000000 00000000164 15263151172 0017311 0 ustar 00root root 0000000 0000000 .DS_Store
.vercel
.vscode
node_modules/
test/compiled_tests
public
lib
docs/LICENSE.md
vuln.js
man/marked.1
test.js
markedjs-marked-cdbdc01/.releaserc.json 0000664 0000000 0000000 00000000312 15263151172 0020232 0 ustar 00root root 0000000 0000000 {
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
}
markedjs-marked-cdbdc01/AGENTS.md 0000664 0000000 0000000 00000021567 15263151172 0016636 0 ustar 00root root 0000000 0000000 # AGENTS.md
Instructions and guidelines for AI agents and LLMs writing code in `marked`.
---
## 1. Project Overview & Core Architecture
`marked` is a high-speed, lightweight Markdown compiler for Node.js, browsers, and CLI. Its defining characteristic is **uncompromising speed**, **zero runtime dependencies**, and **standards compliance** (CommonMark & GitHub Flavored Markdown / GFM).
### Code Pipeline
All core source code lives in `src/` (written in TypeScript):
1. **Pre-processing**: `Hooks.preprocess(markdown)` allows pre-transformation of markdown source.
2. **Block Tokenization**: `Lexer.lex(src)` processes block-level rules using regular expressions defined in `rules.ts` and token methods in `Tokenizer.ts`.
3. **Inline Tokenization**: `Lexer.inlineTokens(src)` breaks text into inline tokens (emphasis, links, codespans, etc.).
4. **Token Walking**: `marked.walkTokens(tokens, callback)` allows extensions to inspect or modify the AST before rendering.
5. **Compilation (Parsing)**: `Parser.parse(tokens)` calls `Renderer.ts` (or `TextRenderer.ts` for plain-text extraction) to generate HTML strings.
6. **Post-processing**: `Hooks.postprocess(html)` processes final output.
### Important Directory Conventions
- **`src/`**: ONLY edit TypeScript source files here.
- **`lib/`**: Generated build output (`marked.esm.js`, `marked.umd.js`, `marked.d.ts`). **NEVER manually edit files in `lib/`**.
- **`test/specs/`**: Spec fixture files organized by spec type (`commonmark/`, `gfm/`, `new/`, `original/`, `redos/`).
- **`test/unit/`**: Node.js test runner unit test files (`*.test.js`).
- **`docs/`**: Documentation pages and doc build scripts.
---
## 2. Core Priorities & Philosophy
When proposing changes, fixing bugs, or implementing features, strictly adhere to the following maintainer priorities:
### 1. Speed is #1 Priority
- **Parsing speed takes precedence over strict edge-case spec compliance**: Marked must remain the fastest Markdown parser. If a CommonMark or GFM spec edge-case requires complex regexes, quadratic parsing, or heavy state tracking that hurts benchmark performance, prioritize speed. Minor edge-case spec divergences can be tolerated or delegated to extensions.
- **Zero Runtime Dependencies**: The core library MUST NOT add any runtime `dependencies` in `package.json`. Everything must run natively and efficiently.
- **No Hot-Path Waste**: Avoid unnecessary object allocations, deep closures, regex recreation, and superfluous string allocations inside hot parsing loops (`Lexer.ts`, `Tokenizer.ts`).
### 2. Extension-First Architecture (Keep Core Lean)
- **Do NOT add non-spec features to core**: Any feature, syntax, or option that is not part of the CommonMark or GFM specifications should NOT be merged into core or added behind new configuration options.
- **Direct users and enhancements to extensions**: Use `marked.use({ extensions, renderer, tokenizer, walkTokens, hooks })`. Marked follows the Open/Closed Principle: provide extension hooks rather than bloating core with endless configuration toggles.
### 3. Security & Scope Boundaries
- **No Sanitization in Core**: Marked's single responsibility is translating Markdown into HTML. Marked deliberately does NOT sanitize HTML output. Do not attempt to add sanitization logic into core; users must use sanitizers like DOMPurify on the output.
- **ReDoS Awareness**: Avoid nested quantifiers `(a+)+` or overlapping alternations that can lead to catastrophic regex backtracking. If introducing or heavily modifying complex regex patterns in `src/rules.ts`, check for backtracking risks.
- **Graceful Failure**: Marked must never throw unhandled exceptions or crash on malformed Markdown input. Treat unexpected syntax as plain text according to spec.
### Priority Label Hierarchy
1. **L0 - Security**: ReDoS vulnerabilities, prototype pollution, memory exhaustion crashes.
2. **L1 - Broken / Performance**: Major bugs causing crashes or severe regressions, or performance bottlenecks.
3. **L2 - Annoying**: Minor bugs where a workaround exists.
4. **RR - Refactor & Re-engineer**: Optimizing execution speed, reducing memory footprint, improving maintainability.
5. **NFS - New Feature (Spec)**: Capabilities required by CommonMark/GFM that do not compromise speed.
6. **NFU / NFE - Non-Spec Requests**: Direct to extensions (`marked.use(...)`).
---
## 3. Build & Test Workflow for Agents
### Critical: Build Before Testing
Tests execute against the compiled bundle in `lib/marked.esm.js`. Therefore, **you MUST compile after editing `src/` before running tests**:
```bash
# Fast build (transpiles TS to ESM and UMD bundles with esbuild)
npm run build:esbuild
# Full build (transpiles code, bundles type definitions, and generates man pages)
npm run build
```
### Essential NPM Scripts
- `npm run build:esbuild`: Fast build using esbuild. Use this during iterative development and test runs.
- `npm run test:only`: Builds and runs spec tests and unit tests with Node's `--test-only` flag.
- `npm run test:unit`: Runs all unit tests (`test/unit/*.test.js`).
- `npm run test:specs`: Runs the spec test suite (CommonMark, GFM, new, original, redos).
- `npm run test:lint` / `npm run lint`: Runs ESLint / auto-fixes formatting.
- `npm run test:types`: Validates TypeScript types (`tsc` + `attw`).
- `npm run test:redos`: Runs `recheck` to scan regex patterns for exponential or polynomial backtracking (run when backtracking concerns are noted).
- `npm run test`: Full test suite (cleans build, builds docs, runs spec, unit, umd, cjs, types, lint).
- `npm run bench`: Runs performance benchmark comparisons against CommonMark and Markdown-it.
- `npm run rules`: Outputs the compiled regex rules from `src/rules.ts` (e.g. `npm run rules -- block.gfm.item`).
- `npm run build:reset`: Cleans up `./lib` and `./public` build artifacts.
### Writing Parsing Spec Tests (Preferred for Parsing)
When writing tests for parsing behavior or Markdown-to-HTML output, **prefer adding spec tests in `test/specs/new/`** instead of unit tests:
1. Create a pair of files:
- `test/specs/new/ hello world Someone who understands and contributes to improving the developer experience and flow of Marked into the world. Can you demonstrate you understand the following without Google and Stackoverflow? Because this author can't yet. That's who gets these. * Still working on metrics for comparative analysis and definition. hello world hello world bold text example line1 No extensions found Try adjusting your keywords or search term. strong em line1 The formula is $a_ b=c_ d$. A Description List: item1 text
# Marked
[](https://www.npmjs.com/package/marked)
[](https://packagephobia.now.sh/result?p=marked)
[](https://www.npmjs.com/package/marked)
[](https://github.com/markedjs/marked/actions)
[](https://snyk.io/test/npm/marked)
[](https://inspect.software/software/markedjs/marked)
- β‘ built for speed
- β¬οΈ low-level compiler for parsing markdown without caching or blocking for long periods of time
- βοΈ light-weight while implementing all markdown features from the supported flavors & specifications
- π οΈ easily adaptable with [custom extensions](https://marked.js.org/using_advanced#extensions)
- π works in a browser, on a server, or from a command line interface (CLI)
## Demo
Check out the [demo page](https://marked.js.org/demo/) to see Marked in action βΉοΈ
## Docs
Our [documentation pages](https://marked.js.org) are also rendered using marked π―
Also read about:
* [Options](https://marked.js.org/using_advanced)
* [Extensibility](https://marked.js.org/using_pro)
## Compatibility
**Node.js:** Only [current and LTS](https://nodejs.org/en/about/releases/) Node.js versions are supported. End of life Node.js versions may become incompatible with Marked at any point in time.
**Browser:** [Baseline Widely Available](https://developer.mozilla.org/en-US/docs/Glossary/Baseline/Compatibility)
## Installation
**CLI:**
```sh
npm install -g marked
```
**In-browser:**
```sh
npm install marked
```
## Usage
### Warning: π¨ Marked does not [sanitize](https://marked.js.org/using_advanced#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! π¨
```
DOMPurify.sanitize(marked.parse(`
`));
```
**CLI**
``` bash
# Example with stdin input
$ marked -o hello.html
hello world
^D
$ cat hello.html
## Contributors
Christopher Jeffrey
Josh Bruce
Steven
Jamie Davis
Tony Brix
Trevor Buckner
## 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](https://reinventingorganizationswiki.com/en/theory/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.
Brandon der BlΓ€tter
Carlos Valle
Federico Soave
Karen Yavine
ΠΠΎΡΡΡ Π’ΡΠ΅ΡΡΠΊ
Tom Theisen
Mateus Craveiro
Badges
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:
### Special badges that come with the job:
"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." ~ Wikipedia
/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/
markedjs-marked-cdbdc01/docs/CODE_OF_CONDUCT.md 0000664 0000000 0000000 00000006311 15263151172 0021050 0 ustar 00root root 0000000 0000000 # 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) 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
markedjs-marked-cdbdc01/docs/CONTRIBUTING.md 0000664 0000000 0000000 00000014064 15263151172 0020506 0 ustar 00root root 0000000 0000000 # 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 test`, 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](/#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](/#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](/#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 see the compiled rules from `src/rules.js`:
```bash
npm run rules
```
You can specify one or more `rule path`s to only show certain rules:
```bash
npm run rules -- block.gfm.item inline.pedantic.br
{
block: {
gfm: {
item: /^( *)((?:[*+-]|\\d{1,9}\\.)) ?[^\\n]*(?:\\n(?!\\1(?:[*+-]|\\d{1,9}\\.) ?)[^\\n]*)*/gm
}
},
inline: {
pedantic: {
br: /^( {2,}|\\\\)\\n(?!\\s*$)/
}
}
}
```
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
```
markedjs-marked-cdbdc01/docs/INDEX.md 0000664 0000000 0000000 00000015070 15263151172 0017444 0 ustar 00root root 0000000 0000000 Marked is
1. built for speed.*
2. a low-level markdown compiler for parsing markdown without caching or blocking for long periods of time.**
3. light-weight while implementing all markdown features from the supported flavors & specifications.***
4. easily adaptable with [custom extensions](/using_advanced#extensions).
5. available as a command line interface (CLI) and running in client- or server-side JavaScript projects.
** Zero dependencies.
*** Strict compliance could result in slower processing when running comparative benchmarking.Demo
Checkout the [demo page](./demo/) to see marked in action βΉοΈ
These documentation pages are also rendered using marked π―
Installation
**CLI:** `npm install -g marked`
**In-browser:**
```
npm install marked
```
Usage
### Warning: π¨ Marked does not [sanitize](/using_advanced#options) the output HTML. If you are processing potentially unsafe strings, it's important to filter for possible XSS attacks. Some filtering options include [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [js-xss](https://github.com/leizongmin/js-xss), [sanitize-html](https://github.com/apostrophecms/sanitize-html) and [insane](https://github.com/bevacqua/insane) on the *output* HTML! π¨
```
DOMPurify.sanitize(marked.parse(``));
```
**β οΈ Input: special ZERO WIDTH unicode characters (for example `\uFEFF`) might interfere with parsing. Some text editors add them at the start of the file (see: [#2139](https://github.com/markedjs/marked/issues/2139)).**
```js
// remove the most common zerowidth characters from the start of the file
marked.parse(
contents.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,"")
)
```
**CLI**
``` bash
# Example with stdin input
$ marked -o hello.html
hello world
^D
$ cat hello.html
line2Supported Markdown specifications
We actively support the features of the following [Markdown flavors](https://github.com/commonmark/CommonMark/wiki/Markdown-Flavors).
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.
List of Tools Using Marked
We actively support the usability of Marked in super-fast markdown transformation, some of Tools using `Marked` for single-page creations are
| Tools | Description |
| :----------------------------------------------------------------- | :------------------------------------------------------------------------ |
| [zero-md](https://zerodevx.github.io/zero-md/) | A native markdown-to-html web component to load and display an external MD file.It uses Marked for super-fast markdown transformation. |
| [texme](https://github.com/susam/texme) | TeXMe is a lightweight JavaScript utility to create self-rendering Markdown + LaTeX documents. |
| [StrapDown.js](https://naereen.github.io/StrapDown.js/) | StrapDown.js is an awesome on-the-fly Markdown to HTML text processor. |
| [raito](https://raito.arnaud.at/) | Mini Markdown Wiki/CMS in 8kb of JavaScript. |
| [Homebrewery](https://homebrewery.naturalcrit.com/) | The Homebrewery is a tool for making authentic looking D&D content using Markdown. It is distributed under the terms of the MIT. |
| [marked_reader](https://github.com/CNOCTAVE/marked_reader) | marked_reader is an open source Markdown reader packed by Electron. |
| [AtlasDocs](https://atlasdocs.io/en/markdown-to-html) | Free document tools that run entirely in the browser; uses Marked to turn Markdown into HTML, PDF and DOCX without uploading files. |
Security
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) 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).
markedjs-marked-cdbdc01/docs/PUBLISHING.md 0000664 0000000 0000000 00000002374 15263151172 0020244 0 ustar 00root root 0000000 0000000 # Releasing Marked
Marked uses [semantic-release](https://github.com/semantic-release/semantic-release) to release new versions. All PRs should use the "Squash and merge" strategy and the commit message should follow the [conventional commit guidelines](https://www.conventionalcommits.org/).
## 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.
## Versioning
We follow [semantic versioning](https://semver.org) where the following sequence is true `[major].[minor].[patch]`:
1. **Major:** There is at least one change to the public API or a break from the [CommonMark](https://spec.commonmark.org/current/) or [GFM](https://github.github.com/gfm/) spec. Only [current and LTS](https://nodejs.org/en/about/releases/) Node.js versions are supported at any point in time. A drop in support for a Node.js version may not result in a semver major bump to Marked.
2. **Minor:** There is at least one new feature added to the public API.
3. **Patch:** Changes that move Marked closer to spec compliance or change a public API that does not break backwards compatibility.
markedjs-marked-cdbdc01/docs/USING_ADVANCED.md 0000664 0000000 0000000 00000044503 15263151172 0020712 0 ustar 00root root 0000000 0000000 Marked instance
By default, Marked stores options and extensions in the global scope. That means changing the options in one script will also change the options in another script since they share the same instance.
If you don't want to mutate global scope, you can create a new instance of Marked to ensure options and extensions are locally scoped.
```js
import { Marked } from 'marked';
const marked = new Marked([options, extension, ...]);
```
|Argument |Type |Notes |
|:--------|:-------|:----------------------------------------------------------------------|
| options |`object`|The same arguments that can be passed to [`marked.use`](/using_pro#use)|
Be careful: marked.use(...) should not be used in a loop or function. It should only be used directly after new Marked is created or marked is imported.
## The `parse` function
```js
import { marked } from 'marked';
marked.parse(markdownString [,options])
```
|Argument |Type |Notes |
|:-----------------------------|:-------|:---------------------------------------------------------------|
|markdownString |`string`|String of markdown source to be compiled. |
|options|`object`|Hash of options. Can also use `marked.use` to set global options|
### Alternative using reference
```js
// Create reference instance
import { marked } from 'marked';
// Set options
marked.use({
async: true,
pedantic: false,
gfm: true,
});
// Compile
console.log(marked.parse(markdownString));
```
Options
|Member |Type |Default |Since |Notes |
|:-----------|:---------|:--------|:--------|:-------------|
|async |`boolean` |`false` |4.1.0 |If true, `walkTokens` functions can be async and `marked.parse` will return a promise that resolves when all walk tokens functions resolve.|
|breaks |`boolean` |`false` |v0.2.7 |If true, add `
` 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/).|
|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) for more details.|
|silent |`boolean` |`false` |v0.2.7 |If true, the parser does not throw any exception or log any warning. Any error will be returned as a string.|
|tokenizer |`object` |`new Tokenizer()`|v1.0.0|An object containing functions to create tokens from markdown. See [extensibility](/using_pro) for more details.|
|walkTokens |`function` |`null`|v1.1.0|A function which is called for every token. See [extensibility](/using_pro) for more details.|
## Old Options
|Member |Type |Default |Since |Notes |
|:-----------|:---------|:--------|:--------|:-------------|
|smartLists (**removed**)| `boolean` | `false` |v0.2.8 | Removed in v3.0.0. |
|baseUrl (**removed**)|`string` |`null` |v0.3.9 |Removed in v8.0.0 use [`marked-base-url`](https://www.npmjs.com/package/marked-base-url) to prefix url for any relative link. |
|headerIds (**removed**)|`boolean` |`true` |v0.4.0 |Removed in v8.0.0 use [`marked-gfm-heading-id`](https://www.npmjs.com/package/marked-gfm-heading-id) to include an `id` attribute when emitting headings (h1, h2, h3, etc).|
|headerPrefix (**removed**)|`string` |`''` |v0.3.0 |Removed in v8.0.0 use [`marked-gfm-heading-id`](https://www.npmjs.com/package/marked-gfm-heading-id) to add a string to prefix the `id` attribute when emitting headings (h1, h2, h3, etc).|
|highlight (**removed**)|`function`|`null` |v0.3.0 |Removed in v8.0.0 use [`marked-highlight`](https://www.npmjs.com/package/marked-highlight) to add highlighting to code blocks. |
|langPrefix (**removed**)|`string` |`'language-'`|v0.3.0|Removed in v8.0.0 use [`marked-highlight`](https://www.npmjs.com/package/marked-highlight) to prefix the className in a `` block. Useful for syntax highlighting.|
|mangle (**removed**)|`boolean` |`true` |v0.3.4 |Removed in v8.0.0 use [`marked-mangle`](https://www.npmjs.com/package/marked-mangle) to mangle email addresses.|
|sanitize (**removed**)|`boolean` |`false` |v0.2.1 |Removed in v8.0.0 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 (**removed**)|`function`|`null` |v0.3.4 |Removed in v8.0.0 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!|
|smartypants (**removed**)|`boolean` |`false` |v0.2.9 |Removed in v8.0.0 use [`marked-smartypants`](https://www.npmjs.com/package/marked-smartypants) to use "smart" typographic punctuation for things like quotes and dashes.|
|xhtml (**removed**)|`boolean` |`false` |v0.3.2 |Removed in v8.0.0 use [`marked-xhtml`](https://www.npmjs.com/package/marked-xhtml) to emit self-closing HTML tags for void elements (<br/>, <img/>, etc.) with a "/" as required by XHTML.|
Known Extensions
Marked can be extended using [custom extensions](/using_pro#extensions). This is a list of extensions that can be used with `marked.use(extension)`.
User Examples
Marked can render on-page content as markdown in the browser.
```html
Inline Markdown
You can parse inline markdown by running markdown through `marked.parseInline`.
```js
const blockHtml = marked.parse('**strong** _em_');
console.log(blockHtml); // 'Highlighting
Use [`marked-highlight`](https://www.npmjs.com/package/marked-highlight) to highlight code blocks.
Workers
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
import { marked } from 'marked';
import { parentPort } from 'worker_threads';
parentPort.on('message', (markdownString) => {
parentPort.postMessage(marked.parse(markdownString));
});
```
```js
// index.js
import { Worker } from '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.umd.js');
onmessage = (e) => {
const markdownString = e.data
postMessage(marked.parse(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);
```
CLI Extensions
You can use extensions in the CLI by creating a new CLI that imports marked and the marked binary.
```js
// file: myMarked
#!/usr/bin/node
import { marked } from 'marked';
import customHeadingId from 'marked-custom-heading-id';
marked.use(customHeadingId());
import 'marked/bin/marked';
```
```sh
$ ./myMarked -s "# heading {#custom-id}"
heading
```
markedjs-marked-cdbdc01/docs/USING_PRO.md 0000664 0000000 0000000 00000071414 15263151172 0020206 0 ustar 00root root 0000000 0000000 ## 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.
Terminology Note
Before diving in, it's important to understand the terminology used in this documentation:
| Term | TypeScript Type | Description |
|------|----------------|-------------|
| **Marked Extension** | `MarkedExtension` | The configuration object passed to `marked.use()`. Can contain options, hooks, renderer overrides, tokenizer overrides, and custom extensions. |
| **Custom Extension** | `TokenizerAndRendererExtension` | Objects within the `extensions` array that define custom tokenizers and renderers for new syntax. |
In other words, a **Marked Extension** is the top-level plugin configuration, while **Custom Extensions** are the individual tokenizer/renderer definitions for custom syntax within that configuration.
```js
// Marked Extension (MarkedExtension)
marked.use({
gfm: true,
breaks: false,
renderer: { /* renderer overrides */ },
tokenizer: { /* tokenizer overrides */ },
// Custom Extensions (TokenizerAndRendererExtension[])
extensions: [
{ name: 'myCustomSyntax', level: 'block', tokenizer: fn, renderer: fn }
]
});
```
marked.use()
`marked.use(extension)` is the recommended way to extend Marked. The `extension` object can contain any [option](/using_advanced#options) available in Marked:
```js
import { marked } from 'marked';
marked.use({
pedantic: false,
gfm: true,
breaks: false
});
```
You can also supply multiple `extension` objects at once.
```js
marked.use(myExtension, extension2, extension3);
\\ EQUIVALENT TO:
marked.use(myExtension);
marked.use(extension2);
marked.use(extension3);
```
All options will overwrite those previously set, except for the following options which will be merged with the existing framework and can be used to change or extend the functionality of Marked: `renderer`, `tokenizer`, `hooks`, `walkTokens`, and `extensions`.
* The `renderer`, `tokenizer`, and `hooks` options are objects with functions that will be merged into the built-in `renderer` and `tokenizer` respectively.
* The `walkTokens` option is a function that will be called to post-process every token before rendering.
* The `extensions` option is an array of objects that can contain additional custom `renderer` and `tokenizer` steps that will execute before any of the default parsing logic occurs.
Importantly, ensure that the extensions are only added to `marked` once (ie in the global scope of a regular JavaScript or TypeScript module). If they are added in a function that is called repeatedly, or in the JS for an HTML component in a library such as Svelte, your extensions will be added repeatedly, eventually causing a recursion error. If you cannot prevent the code from being run repeatedly, you should create a [Marked instance](/using_advanced#instance) so that your extensions are stored independently from the global instance Marked provides.
***
The Marked Pipeline
Before building your custom extensions, it is important to understand the components that Marked uses to translate from Markdown to HTML:
1) The user supplies Marked with an input string to be translated.
2) The `lexer` feeds segments of the input text string into each `tokenizer`, and from their output, generates a series of tokens in a nested tree structure.
3) Each `tokenizer` receives a segment of Markdown text and, if it matches a particular pattern, generates a token object containing any relevant information.
4) The `walkTokens` function will traverse every token in the tree and perform any final adjustments to the token contents.
4) The `parser` traverses the token tree and feeds each token into the appropriate `renderer`, and concatenates their outputs into the final HTML result.
5) Each `renderer` receives a token and manipulates its contents to generate a segment of HTML.
Marked provides methods for directly overriding the `renderer` and `tokenizer` for any existing token type, as well as inserting additional custom `renderer` and `tokenizer` functions to handle entirely custom syntax. For example, using `marked.use({renderer})` would modify a renderer, whereas `marked.use({extensions: [{renderer}]})` would add a new renderer. See the [custom extensions example](#custom-extensions-example) for insight on how to execute this.
***
The Renderer :
The renderer defines the HTML output of a given token. If you supply a `renderer` in the options object passed to `marked.use()`, any functions in the object will override the default handling of that token type.
Calling `marked.use()` to override the same function multiple times will give priority to the version that was assigned *last*. Overriding functions can return `false` to fall back to the previous override in the sequence, or resume default behavior if all overrides return `false`. Returning any other value (including nothing) will prevent fallback behavior.
**Example:** Overriding output of the default `heading` token by adding an embedded anchor tag like on GitHub.
```js
// Create reference instance
import { marked } from 'marked';
// Override function
const renderer = {
heading({ tokens, depth }) {
const text = this.parser.parseInline(tokens);
const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
return `
renderer
heading+
```
**Note:** Calling `marked.use()` in the following way will avoid overriding the `heading` token output but create a new `heading` renderer in the process.
```js
marked.use({
extensions: [{
name: 'heading',
renderer(token) {
return /* ... */
}
}]
})
```
### Block-level renderer methods
- **space**(token: *Tokens.Space*): *string*
- **code**(token: *Tokens.Code*): *string*
- **blockquote**(token: *Tokens.Blockquote*): *string*
- **html**(token: *Tokens.HTML | Tokens.Tag*): *string*
- **heading**(token: *Tokens.Heading*): *string*
- **hr**(token: *Tokens.Hr*): *string*
- **list**(token: *Tokens.List*): *string*
- **listitem**(token: *Tokens.ListItem*): *string*
- **checkbox**(token: *Tokens.Checkbox*): *string*
- **paragraph**(token: *Tokens.Paragraph*): *string*
- **table**(token: *Tokens.Table*): *string*
- **tablerow**(token: *Tokens.TableRow*): *string*
- **tablecell**(token: *Tokens.TableCell*): *string*
### Inline-level renderer methods
- **strong**(token: *Tokens.Strong*): *string*
- **em**(token: *Tokens.Em*): *string*
- **codespan**(token: *Tokens.Codespan*): *string*
- **br**(token: *Tokens.Br*): *string*
- **del**(token: *Tokens.Del*): *string*
- **link**(token: *Tokens.Link*): *string*
- **image**(token: *Tokens.Image*): *string*
- **text**(token: *Tokens.Text | Tokens.Escape | Tokens.Tag*): *string*
The Tokens.* properties can be found [here](https://github.com/markedjs/marked/blob/master/src/Tokens.ts).
***
The Tokenizer :
The tokenizer defines how to turn markdown text into tokens. If you supply a `tokenizer` object to the Marked options, it will be merged with the built-in tokenizer and any functions inside will override the default handling of that token type.
Calling `marked.use()` to override the same function multiple times will give priority to the version that was assigned *last*. Overriding functions can return `false` to fall back to the previous override in the sequence, or resume default behavior if all overrides return `false`. Returning any other value (including nothing) will prevent fallback behavior.
**Example:** Overriding default `codespan` tokenizer to include LaTeX.
```js
// Create reference instance
import { marked } from '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.parse('$ latex code $\n\n` other code `'));
```
**Output:**
```html
tokenizerlatex codeother code**space**(src: *string*): *Tokens.Space*
- **code**(src: *string*): *Tokens.Code*
- **fences**(src: *string*): *Tokens.Code*
- **heading**(src: *string*): *Tokens.Heading*
- **hr**(src: *string*): *Tokens.Hr*
- **blockquote**(src: *string*): *Tokens.Blockquote*
- **list**(src: *string*): *Tokens.List*
- **html**(src: *string*): *Tokens.HTML*
- **def**(src: *string*): *Tokens.Def*
- **table**(src: *string*): *Tokens.Table*
- **lheading**(src: *string*): *Tokens.Heading*
- **paragraph**(src: *string*): *Tokens.Paragraph*
- **text**(src: *string*): *Tokens.Text*
### Inline level tokenizer methods
- **escape**(src: *string*): *Tokens.Escape*
- **tag**(src: *string*): *Tokens.Tag*
- **link**(src: *string*): *Tokens.Link | Tokens.Image*
- **reflink**(src: *string*, links: *object*): *Tokens.Link | Tokens.Image | Tokens.Text*
- **emStrong**(src: *string*, maskedSrc: *string*, prevChar: *string*): *Tokens.Em | Tokens.Strong*
- **codespan**(src: *string*): *Tokens.Codespan*
- **br**(src: *string*): *Tokens.Br*
- **del**(src: *string*): *Tokens.Del*
- **autolink**(src: *string*): *Tokens.Link*
- **url**(src: *string*): *Tokens.Link*
- **inlineText**(src: *string*): *Tokens.Text*
The Tokens.* properties can be found [here](https://github.com/markedjs/marked/blob/master/src/Tokens.ts).
***
Walk Tokens :
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. When [`async`](#async) mode is enabled, the return value is awaited. Otherwise the return value is ignored.
`marked.use()` can be called multiple times with different `walkTokens` functions. Each function will be called in order, starting with the function that was assigned *last*.
**Example:** Overriding heading tokens to start at h2.
```js
import { marked } from 'marked';
// Override function
const walkTokens = (token) => {
if (token.type === 'heading') {
token.depth += 1;
}
};
marked.use({ walkTokens });
// Run marked
console.log(marked.parse('# heading 2\n\n## heading 3'));
```
**Output:**
```html
walkTokensheading 2
heading 3
```
***
Hooks :
Hooks are methods that hook into some part of marked. The following hooks are available:
| signature | description |
|-----------|-------------|
| `preprocess(markdown: string): string` | Process markdown before sending it to marked. |
| `postprocess(html: string): string` | Process html after marked has finished parsing. |
| `processAllTokens(tokens: Token[]): Token[]` | Process all tokens before walk tokens. |
| `emStrongMask(src: string): string` | Mask part of the content that should not be interpreted as Markdown em/strong delimiters. |
| `provideLexer(): (src: string, options?: MarkedOptions) => Token[]` | Provide function to tokenize markdown. |
| `provideParser(): (tokens: Token[], options?: MarkedOptions) => string` | Provide function to parse tokens. |
`marked.use()` can be called multiple times with different `hooks` functions. Each function will be called in order, starting with the function that was assigned *last*.
**Example:** Set options based on [front-matter](https://www.npmjs.com/package/front-matter)
```js
import { marked } from 'marked';
import fm from 'front-matter';
// Override function
function preprocess(markdown) {
const { attributes, body } = fm(markdown);
for (const prop in attributes) {
if (prop in this.options) {
this.options[prop] = attributes[prop];
}
}
return body;
}
marked.use({ hooks: { preprocess } });
// Run marked
console.log(marked.parse(`
---
breaks: true
---
line1
line2
`.trim()));
```
**Output:**
```html
hooks
line2
`));
```
**Output:**
```html
```
**Example:** Save reflinks for chunked rendering
```js
import { marked, Lexer } from 'marked';
let refLinks = {};
// Override function
function processAllTokens(tokens) {
refLinks = tokens.links;
return tokens;
}
function provideLexer(src, options) {
return (src, options) => {
const lexer = new Lexer(options);
lexer.tokens.links = refLinks;
return this.block ? lexer.lex(src) : lexer.inlineTokens(src);
};
}
marked.use({ hooks: { processAllTokens, provideLexer } });
// Parse reflinks separately from markdown that uses them
marked.parse(`
[test]: http://example.com
`);
console.log(marked.parse(`
[test link][test]
`));
```
**Output:**
```html
```
**Example:** Mask underline characters inside Mathjax content delimited by `$`
```js
import { marked } from 'marked';
// Override function
function emStrongMask(src) {
return src.replace(/\$([^$]+)\$/g, (match) => `[${'a'.repeat(match.length - 2)}]`);
}
marked.use({ hooks: { emStrongMask } });
console.log(marked.parse(`_The formula is $a_ b=c_ d$._`));
```
**Output:**
```html
Custom Extensions :
You may supply an `extensions` array to the `options` object. This array can contain any number of `extension` objects, using the following properties:
extensions
> Note: If you would like to release an extension as an npm package you may use the [Marked Extension Template](https://github.com/markedjs/marked-extension-template) which includes all of the things you need to get started. Feel free to create an issue in that [repo](https://github.com/markedjs/marked-extension-template) if you need help.
**Example:** Add a custom syntax to generate `namelevelstart(string src)src.match().index, or even a simple src.indexOf(). Marked will use this function to ensure that it does not skip over any text that should be part of the custom token.tokenizer(string src, array tokens)src string. Accordingly, if using a Regular Expression to detect a token, it should be anchored to the string start (`^`). The tokens parameter contains the array of tokens that have been generated by the lexer up to that point, and can be used to access the previous token, for instance.
The return value should be an object with the following parameters:
The returned token can also contain any other custom parameters of your choice that your custom `renderer` might need to access.
The tokenizer function has access to the lexer in the `this` object, which can be used if any internal section of the string needs to be parsed further, such as in handling any inline syntax on the text within a block token. The key functions that may be useful include:
typename parameter of the extension.rawtokens [optional]walkTokens function by default.
this.lexer.blockTokens(string text, array tokens)tokens array. The tokens array is also returned by the function. You might use this, for example, if your extension creates a "container"-type token (such as a blockquote) that can potentially include other block-level tokens inside.this.lexer.inline(string text, array tokens)text and tokens to a queue to be processed using inline-level tokenizers (including any inline-level extensions) at that later step. Tokens will be generated using the provided text, and any resulting tokens will be appended to the tokens array. Note that this function does **NOT** return anything since the inline processing cannot happen until the block-level processing is complete.this.lexer.inlineTokens(string text, array tokens)
token inside of a **strong**
). This runs the inline tokenizer functions (including any inline-level extensions) on the provided text, and appends any resulting tokens onto the ### Headingtokens array. The tokens array is also returned by the function.renderer(object token)
this.parser.parse(array tokens)this.parser.parseInline(array tokens)childTokens [optional]walkTokens functions. For instance, if you want to use a second custom parameter to contain child tokens in addition to tokens, it could be listed here. If childTokens is provided, the tokens array will not be walked by default unless it is also included in the childTokens array.` description lists.
``` js
const descriptionList = {
name: 'descriptionList',
level: 'block', // Is this a block-level or inline-level tokenizer?
start(src) { return src.match(/:[^:\n]/)?.index; }, // Hint to Marked.js to stop and check for a match
tokenizer(src, tokens) {
const rule = /^(?::[^:\n]+:[^:\n]*(?:\n|$))+/; // Regex for the complete token, anchor to string start
const match = rule.exec(src);
if (match) {
const token = { // Token to generate
type: 'descriptionList', // Should match "name" above
raw: match[0], // Text to consume from the source
text: match[0].trim(), // Additional custom properties
tokens: [] // Array where child inline tokens will be generated
};
this.lexer.inline(token.text, token.tokens); // Queue this data to be processed for inline tokens
return token;
}
},
renderer(token) {
return `
${this.parser.parseInline(token.tokens)}\n
`; // parseInline to turn child tokens into HTML
}
};
const description = {
name: 'description',
level: 'inline', // Is this a block-level or inline-level tokenizer?
start(src) { return src.match(/:/)?.index; }, // Hint to Marked.js to stop and check for a match
tokenizer(src, tokens) {
const rule = /^:([^:\n]+):([^:\n]*)(?:\n|$)/; // Regex for the complete token, anchor to string start
const match = rule.exec(src);
if (match) {
return { // Token to generate
type: 'description', // Should match "name" above
raw: match[0], // Text to consume from the source
dt: this.lexer.inlineTokens(match[1].trim()), // Additional custom properties, including
dd: this.lexer.inlineTokens(match[2].trim()) // any further-nested inline tokens
};
}
},
renderer(token) {
return `\n
```
***
Async Marked :
Marked will return a promise if the `async` option is true. The `async` option will tell marked to await any `walkTokens` functions before parsing the tokens and returning an HTML string.
Simple Example:
```js
const walkTokens = async (token) => {
if (token.type === 'link') {
try {
await fetch(token.href);
} catch (ex) {
token.title = 'invalid';
}
}
};
marked.use({ walkTokens, async: true });
const markdown = `
[valid link](https://example.com)
[invalid link](https://invalidurl.com)
`;
const html = await marked.parse(markdown);
```
Custom Extension Example:
```js
const importUrl = {
extensions: [{
name: 'importUrl',
level: 'block',
start(src) { return src.indexOf('\n:'); },
tokenizer(src) {
const rule = /^:(https?:\/\/.+?):/;
const match = rule.exec(src);
if (match) {
return {
type: 'importUrl',
raw: match[0],
url: match[1],
html: '' // will be replaced in walkTokens
};
}
},
renderer(token) {
return token.html;
}
}],
async: true, // needed to tell marked to return a promise
async walkTokens(token) {
if (token.type === 'importUrl') {
const res = await fetch(token.url);
token.html = await res.text();
}
}
};
marked.use(importUrl);
const markdown = `
# example.com
:https://example.com:
`;
const html = await marked.parse(markdown);
```
asyncThe Lexer
The lexer takes a markdown string and calls the tokenizer functions.
The Parser
The parser takes tokens as input and calls the renderer functions.
Access to Lexer and Parser
You also have direct access to the lexer and parser if you so desire. The lexer and parser options are the same as passed to `marked.setOptions()` except they have to be full options objects, they don't get merged with the current or default options.
``` 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
```
Note that the lexer can be used in two different ways:
- `marked.lexer()`: this method tokenizes a string and returns its tokens. Subsequent calls to `lexer()` ignore any previous calls.
- `new marked.Lexer().lex()`: this instance tokenizes a string and returns its tokens along with any previous tokens. Subsequent calls to `lex()` accumulate tokens.
``` 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
import { marked } from '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"
}
}
]
heading
```
markedjs-marked-cdbdc01/docs/_document.html 0000664 0000000 0000000 00000040706 15263151172 0021122 0 ustar 00root root 0000000 0000000
Marked Documentation
item1
text
world
world
item1
text
item1
text
world
world
world
world
code>var a = 1;
<div>hello</div>
<span>hello</span>
``` ``` bash $ markedhello
``` - - - See: https://github.com/evilstreak/markdown-js/issues/27 ``` bash $ markdown.js [](/link) ^D ``` ``` bash $ marked [](/link) ^D ``` - - - See: https://github.com/evilstreak/markdown-js/issues/24 ``` bash $ markdown.js > a > b > c ^D``` ``` bash $ marked > a > b > c ^Da
bundefined> c
a
b
``` - - - ``` bash $ markdown.pl * hello * world how are you * today * hi ^Dc
hello
are you
hello
world how
are you
today
tag
itself has a background, hiding the background.
*/
.prose pre code.hljs {
background-color: transparent !important;
}
/* ============================================
MOBILE RESPONSIVE STYLES
============================================ */
/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
display: none; /* Hidden on desktop by default */
position: fixed;
top: 16px;
left: 16px;
z-index: 9998;
width: 48px;
height: 48px;
border: none;
border-radius: 8px;
background-color: var(--background-color);
color: var(--text-color);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
cursor: pointer;
transition: background-color 0.3s ease, transform 0.2s ease;
align-items: center;
justify-content: center;
}
.mobile-menu-toggle:hover {
background-color: var(--code-bg-color);
transform: scale(1.05);
}
.mobile-menu-toggle:active {
transform: scale(0.95);
}
.dark .mobile-menu-toggle {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
/* Mobile Overlay */
.mobile-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 39;
opacity: 0;
transition: opacity 0.3s ease;
}
.mobile-overlay.active {
opacity: 1;
}
/* Mobile Styles - Changed breakpoint from 768px to 1024px */
@media (max-width: 1024px) {
/* Show mobile menu button */
.mobile-menu-toggle {
display: flex;
}
/* Hide sidebar by default on mobile */
.sidebar {
transform: translateX(-100%);
transition: transform 0.3s ease;
}
/* Show sidebar when menu is open */
.sidebar.mobile-open {
transform: translateX(0);
}
/* Show overlay when menu is open */
.mobile-overlay.active {
display: block;
}
/* Adjust main content for mobile */
.main-content {
margin-left: 0 !important;
padding: 80px 20px 20px 20px !important;
width: 100%;
}
/* Make sidebar full height on mobile */
.sidebar {
width: 280px;
max-width: 85vw;
}
/* Adjust heading sizes for mobile */
.main-content h1 {
font-size: 2rem !important;
}
/* Adjust prose max-width for mobile */
.prose {
max-width: 100% !important;
}
/* Make tables scrollable on mobile */
.prose table:not(.hidden) {
display: block;
overflow-x: auto;
white-space: nowrap;
}
/* Adjust code blocks for mobile */
.prose pre {
font-size: 0.875rem;
padding: 1rem;
}
}
/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
overflow: hidden;
}
@media (max-width: 1024px) {
body.mobile-menu-open {
overflow: hidden;
}
}
markedjs-marked-cdbdc01/docs/demo/ 0000775 0000000 0000000 00000000000 15263151172 0017174 5 ustar 00root root 0000000 0000000 markedjs-marked-cdbdc01/docs/demo/demo.css 0000664 0000000 0000000 00000007524 15263151172 0020642 0 ustar 00root root 0000000 0000000 html, body {
margin: 0;
padding: 0;
font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
color: var(--text-color);
background-color: var(--background-color);
height: 100%;
overflow: auto;
transition: background-color 0.3s ease, color 0.3s ease;
}
textarea {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
font-size: 12px;
resize: none;
}
header {
padding: 16px 24px;
display: flex;
align-items: center;
height: 68px;
box-sizing: border-box;
border-bottom: 1px solid var(--border-color);
gap: 16px;
overflow-x: auto;
overflow-y: hidden;
}
header .logo-link {
display: flex;
align-items: center;
}
header h1 {
margin: 0;
font-size: 24px;
font-weight: 700;
color: inherit;
}
.other-demos {
margin-left: auto;
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
}
.other-demos a {
color: var(--subtle-text-color);
text-decoration: none;
transition: color 0.2s ease;
}
.other-demos a:hover {
color: #3B82F6;
}
.other-demos .separator {
color: var(--subtle-text-color);
}
.theme-toggle {
margin-inline: 16px 60px;
display: flex;
align-items: center;
gap: 8px;
padding: 8px 16px;
border: none;
border-radius: 8px;
background-color: transparent;
color: var(--subtle-text-color);
cursor: pointer;
font-family: inherit;
font-size: 14px;
font-weight: 500;
transition: background-color 0.2s ease, color 0.2s ease;
}
@media (max-width: 768px) {
/* When github corner is invisible */
.theme-toggle {
margin-right: 0;
}
a.github-corner {
display: none !important;
}
}
.theme-toggle:hover {
background-color: var(--code-bg-color);
color: var(--text-color);
}
.theme-toggle .material-icons {
font-size: 20px;
}
.containers {
display: flex;
height: calc(100vh - 68px);
gap: 12px;
padding: 12px;
box-sizing: border-box;
}
@media (max-width: 900px) {
.containers {
flex-direction: column;
}
}
.container {
flex-basis: 50%;
display: flex;
flex-direction: column;
height: 100%;
box-sizing: border-box;
}
.label {
padding: 8px 12px;
background-color: var(--code-bg-color);
border: 1px solid var(--border-color);
border-radius: 8px 8px 0 0;
font-size: 14px;
font-weight: 500;
display: flex;
align-items: center;
gap: 8px;
color: var(--text-color);
overflow-x: auto;
overflow-y: hidden;
}
.label select,
.label button {
padding: 4px 8px;
border-radius: 4px;
border: 1px solid var(--border-color);
background-color: var(--background-color);
color: var(--text-color);
font-size: 13px;
cursor: pointer;
transition: border-color 0.2s ease;
}
.label select:hover,
.label button:hover {
border-color: #3B82F6;
}
.label a {
color: #3B82F6;
text-decoration: none;
}
.label a:hover {
text-decoration: underline;
}
.pane, .inputPane {
padding: 12px;
border: 1px solid var(--border-color);
border-top: none;
border-radius: 0 0 8px 8px;
overflow: auto;
flex-grow: 1;
flex-shrink: 1;
background-color: var(--background-color);
color: var(--text-color);
transition: background-color 0.3s ease, border-color 0.3s ease;
}
#preview {
display: flex;
}
#preview iframe {
flex-grow: 1;
border-radius: 0 0 8px 8px;
}
#main {
display: none;
}
#loading {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
font-size: 18px;
color: var(--subtle-text-color);
}
.error {
border-color: #EF4444 !important;
background-color: #FEF2F2 !important;
}
.loadingError {
background-color: #FEF2F2;
font-weight: 600;
color: #DC2626;
text-align: center;
padding: 16px;
border-radius: 8px;
margin: 20px;
}
#responseTime {
display: inline-block;
font-weight: 600;
color: #3B82F6;
}
/* Dark mode specific overrides */
html.dark .error {
background-color: #2c1d1d !important;
border-color: #F87171 !important;
color: #FCA5A5;
}
html.dark .loadingError {
background-color: #2c1d1d;
color: #FCA5A5;
}
html.dark #loading {
color: #9CA3AF;
}
markedjs-marked-cdbdc01/docs/demo/demo.js 0000664 0000000 0000000 00000036320 15263151172 0020462 0 ustar 00root root 0000000 0000000 onunhandledrejection = (e) => {
throw e.reason;
};
const $loadingElem = document.querySelector('#loading');
const $mainElem = document.querySelector('#main');
const $markdownElem = document.querySelector('#markdown');
const $markedVerElem = document.querySelector('#markedVersion');
const $optionsElem = document.querySelector('#options');
const $outputTypeElem = document.querySelector('#outputType');
const $inputTypeElem = document.querySelector('#inputType');
const $responseTimeElem = document.querySelector('#responseTime');
const $previewElem = document.querySelector('#preview');
const $previewIframe = document.querySelector('#preview iframe');
const $permalinkElem = document.querySelector('#permalink');
const $clearElem = document.querySelector('#clear');
const $htmlElem = document.querySelector('#html');
const $lexerElem = document.querySelector('#lexer');
const $panes = document.querySelectorAll('.pane');
const $inputPanes = document.querySelectorAll('.inputPane');
let lastInput = '';
let inputDirty = true;
let $activeOutputElem = null;
let latestVersion = 'master';
const search = searchToObject();
const markedVersions = {
master: '../',
commonmark: 'commonmark',
gfm: 'gfm',
};
let delayTime = 1;
let checkChangeTimeout = null;
let markedWorker;
$previewIframe.addEventListener('load', handleIframeLoad);
$outputTypeElem.addEventListener('change', handleOutputChange, false);
$inputTypeElem.addEventListener('change', handleInputChange, false);
$markedVerElem.addEventListener('change', handleVersionChange, false);
$markdownElem.addEventListener('change', handleInput, false);
$markdownElem.addEventListener('keyup', handleInput, false);
$markdownElem.addEventListener('keypress', handleInput, false);
$markdownElem.addEventListener('keydown', handleInput, false);
$optionsElem.addEventListener('change', handleInput, false);
$optionsElem.addEventListener('keyup', handleInput, false);
$optionsElem.addEventListener('keypress', handleInput, false);
$optionsElem.addEventListener('keydown', handleInput, false);
$clearElem.addEventListener('click', handleClearClick, false);
// --- Theme Toggle Setup ---
const $themeToggle = document.getElementById('theme-toggle');
const $themeToggleIcon = $themeToggle ? $themeToggle.querySelector('[data-theme-icon]') : null;
const $themeToggleText = $themeToggle ? $themeToggle.querySelector('[data-theme-text]') : null;
const THEME_STORAGE_KEY = 'theme-preference';
const LEGACY_STORAGE_KEY = 'theme';
const THEME_ORDER = ['system', 'light', 'dark'];
const TOGGLE_UI = {
system: { icon: 'brightness_auto', text: 'System' },
light: { icon: 'light_mode', text: 'Light' },
dark: { icon: 'dark_mode', text: 'Dark' },
};
function applyTheme(theme) {
if (theme === 'dark') {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
document.documentElement.setAttribute('data-theme', theme);
try {
if ($previewIframe && $previewIframe.contentDocument) {
if (theme === 'dark') {
$previewIframe.contentDocument.documentElement.classList.add('dark');
} else {
$previewIframe.contentDocument.documentElement.classList.remove('dark');
}
}
} catch {
// Ignore cross-origin errors
}
}
function getSystemTheme() {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
return 'dark';
}
return 'light';
}
function sanitisePreference(value) {
return THEME_ORDER.includes(value) ? value : null;
}
function readStoredPreference() {
try {
const stored = sanitisePreference(localStorage.getItem(THEME_STORAGE_KEY));
if (stored) {
return stored;
}
return sanitisePreference(localStorage.getItem(LEGACY_STORAGE_KEY));
} catch {
return null;
}
}
function writeStoredPreference(preference) {
try {
localStorage.setItem(THEME_STORAGE_KEY, preference);
if (preference === 'light' || preference === 'dark') {
localStorage.setItem(LEGACY_STORAGE_KEY, preference);
} else {
localStorage.removeItem(LEGACY_STORAGE_KEY);
}
} catch {
// Storage might be unavailable; ignore
}
}
function getEffectiveTheme(preference) {
return preference === 'system' ? getSystemTheme() : preference;
}
function updateToggle(preference) {
if (!$themeToggle) {
return;
}
const details = TOGGLE_UI[preference] || TOGGLE_UI.system;
if ($themeToggleIcon) {
$themeToggleIcon.textContent = details.icon;
}
if ($themeToggleText) {
$themeToggleText.textContent = details.text;
}
$themeToggle.setAttribute('data-theme-mode', preference);
const label = `Switch theme (current: ${details.text})`;
$themeToggle.setAttribute('aria-label', label);
$themeToggle.title = label;
}
let currentPreference = readStoredPreference() || 'system';
function applyPreference(preference, persist) {
currentPreference = preference;
const effectiveTheme = getEffectiveTheme(preference);
applyTheme(effectiveTheme);
document.documentElement.setAttribute('data-theme-preference', preference);
updateToggle(preference);
if (persist) {
writeStoredPreference(preference);
}
}
applyPreference(currentPreference, true);
if ($themeToggle) {
$themeToggle.addEventListener('click', function() {
const index = THEME_ORDER.indexOf(currentPreference);
const nextIndex = (index + 1) % THEME_ORDER.length;
const nextPreference = THEME_ORDER[nextIndex];
applyPreference(nextPreference, true);
});
}
const systemMatcher = window.matchMedia ? window.matchMedia('(prefers-color-scheme: dark)') : null;
if (systemMatcher) {
const handleSystemChange = function() {
if (currentPreference === 'system') {
applyPreference('system', false);
}
};
if (typeof systemMatcher.addEventListener === 'function') {
systemMatcher.addEventListener('change', handleSystemChange);
} else if (typeof systemMatcher.addListener === 'function') {
systemMatcher.addListener(handleSystemChange);
}
}
Promise.all([
setInitialQuickref(),
setInitialOutputType(),
setInitialText(),
setInitialVersion().then(setInitialOptions),
])
.then(() => {
handleInputChange();
handleOutputChange();
checkForChanges();
setScrollPercent(0);
$loadingElem.style.display = 'none';
$mainElem.style.display = 'block';
})
.catch(() => {
$loadingElem.classList.add('loadingError');
$loadingElem.textContent =
'Failed to load marked. Refresh the page to try again.';
});
function setInitialText() {
if ('text' in search) {
$markdownElem.value = search.text;
} else {
return fetch('./initial.md')
.then((res) => res.text())
.then((text) => {
if ($markdownElem.value === '') {
$markdownElem.value = text;
}
});
}
}
function setInitialQuickref() {
return fetch('./quickref.md')
.then((res) => res.text())
.then((text) => {
document.querySelector('#quickref').value = text;
});
}
function setInitialVersion() {
return fetch('https://data.jsdelivr.com/v1/package/npm/marked')
.then((res) => res.json())
.then((json) => {
for (const ver of json.versions) {
markedVersions[ver] = 'https://cdn.jsdelivr.net/npm/marked@' + ver;
const opt = document.createElement('option');
opt.textContent = ver;
opt.value = ver;
$markedVerElem.appendChild(opt);
}
if (location.host === 'marked.js.org') {
latestVersion = json.tags.latest;
} else {
$markedVerElem.querySelector('option[value="master"]').textContent =
'This Build';
}
if (search.version && markedVersions[search.version]) {
$markedVerElem.value = search.version;
return;
}
$markedVerElem.value = latestVersion;
})
.then(updateVersion);
}
function setInitialOptions() {
if ('options' in search) {
$optionsElem.value = search.options;
} else {
return setDefaultOptions();
}
}
function setInitialOutputType() {
if (search.outputType) {
$outputTypeElem.value = search.outputType;
}
}
function handleIframeLoad() {
lastInput = '';
inputDirty = true;
// Apply current theme to the iframe
try {
const currentTheme = document.documentElement.classList.contains('dark')
? 'dark'
: 'light';
if ($previewIframe && $previewIframe.contentDocument) {
if (currentTheme === 'dark') {
$previewIframe.contentDocument.documentElement.classList.add('dark');
} else {
$previewIframe.contentDocument.documentElement.classList.remove('dark');
}
}
} catch {
// Ignore cross-origin errors
}
}
let debounceInputDirty;
function handleInput() {
if ($markedVerElem.value === 'gfm') {
// GFM api limits requests to 60 per hour so we
// are debouncing here to limit unneccessary requests
clearTimeout(debounceInputDirty);
debounceInputDirty = setTimeout(() => {
inputDirty = true;
}, 500);
} else {
inputDirty = true;
}
}
function handleVersionChange() {
updateVersion();
}
function handleClearClick() {
$markdownElem.value = '';
$markedVerElem.value = latestVersion;
updateVersion();
setDefaultOptions();
}
function handleInputChange() {
handleChange($inputPanes, $inputTypeElem.value);
}
function handleOutputChange() {
$activeOutputElem = handleChange($panes, $outputTypeElem.value);
updateLink();
}
function handleChange(panes, visiblePane) {
let active = null;
for (let i = 0; i < panes.length; i++) {
if (panes[i].id === visiblePane) {
panes[i].style.display = '';
active = panes[i];
} else {
panes[i].style.display = 'none';
}
}
return active;
}
function setDefaultOptions() {
return messageWorker({
task: 'defaults',
version: markedVersions[$markedVerElem.value],
});
}
function setOptions(opts) {
$optionsElem.value = JSON.stringify(
opts,
(key, value) => {
if (value !== null
&& typeof value === 'object'
&& Object.getPrototypeOf(value) !== Object.prototype
) {
return undefined;
}
return value;
},
' ',
);
}
function searchToObject() {
// modified from https://stackoverflow.com/a/7090123/806777
const pairs = location.search.slice(1).split('&');
const obj = {};
for (let i = 0; i < pairs.length; i++) {
if (pairs[i] === '') {
continue;
}
const pair = pairs[i].split('=');
obj[decodeURIComponent(pair.shift())] = decodeURIComponent(pair.join('='));
}
return obj;
}
function getScrollSize() {
if (!$activeOutputElem) {
return 0;
}
const e = $activeOutputElem;
return e.scrollHeight - e.clientHeight;
}
function getScrollPercent() {
if (!$activeOutputElem) {
return 1;
}
const size = getScrollSize();
if (size <= 0) {
return 1;
}
return $activeOutputElem.scrollTop / size;
}
function setScrollPercent(percent) {
if ($activeOutputElem) {
$activeOutputElem.scrollTop = percent * getScrollSize();
}
}
function updateLink() {
let outputType = '';
if ($outputTypeElem.value !== 'preview') {
outputType = 'outputType='
+ $outputTypeElem.value
+ '&';
}
$permalinkElem.href = '?'
+ outputType
+ 'text='
+ encodeURIComponent($markdownElem.value)
+ '&options='
+ encodeURIComponent($optionsElem.value)
+ '&version='
+ encodeURIComponent($markedVerElem.value);
history.replaceState('', document.title, $permalinkElem.href);
}
function updateVersion() {
handleInput();
}
function checkForChanges() {
if (inputDirty) {
inputDirty = false;
updateLink();
let options = {};
const optionsString = $optionsElem.value || '{}';
try {
const newOptions = JSON.parse(optionsString);
options = newOptions;
$optionsElem.classList.remove('error');
} catch {
$optionsElem.classList.add('error');
}
const version = markedVersions[$markedVerElem.value];
const markdown = $markdownElem.value;
const hash = version + markdown + optionsString;
if (lastInput !== hash) {
lastInput = hash;
delayTime = 100;
messageWorker({
task: 'parse',
version,
markdown,
options,
});
}
}
checkChangeTimeout = window.setTimeout(checkForChanges, delayTime);
}
function setResponseTime(ms) {
let amount = ms;
let suffix = 'ms';
if (ms > 1000 * 60 * 60) {
amount = 'Too Long';
suffix = '';
} else if (ms > 1000 * 60) {
amount = '>'
+ Math.floor(ms / (1000 * 60));
suffix = 'm';
} else if (ms > 1000) {
amount = '>'
+ Math.floor(ms / 1000);
suffix = 's';
}
$responseTimeElem.textContent = amount + suffix;
$responseTimeElem.animate(
[{ transform: 'scale(1.2)' }, { transform: 'scale(1)' }],
200,
);
}
function setParsed(parsed, lexed) {
try {
$previewIframe.contentDocument.body.innerHTML = parsed;
} catch {}
$htmlElem.value = parsed;
$lexerElem.value = lexed;
}
const workerPromises = {};
function messageWorker(message) {
if (!markedWorker || markedWorker.working) {
if (markedWorker) {
clearTimeout(markedWorker.timeout);
markedWorker.terminate();
}
markedWorker = new Worker('worker.js');
markedWorker.onmessage = (e) => {
clearTimeout(markedWorker.timeout);
markedWorker.working = false;
switch (e.data.task) {
case 'defaults': {
setOptions(e.data.defaults);
break;
}
case 'parse': {
if (e.data.error) {
$previewElem.classList.add('error');
$htmlElem.classList.add('error');
$lexerElem.classList.add('error');
} else {
$previewElem.classList.remove('error');
$htmlElem.classList.remove('error');
$lexerElem.classList.remove('error');
}
const scrollPercent = getScrollPercent();
setParsed(e.data.parsed, e.data.lexed);
setScrollPercent(scrollPercent);
setResponseTime(e.data.time);
break;
}
}
clearTimeout(checkChangeTimeout);
delayTime = 10;
checkForChanges();
workerPromises[e.data.id](e.data);
delete workerPromises[e.data.id];
};
markedWorker.onerror = markedWorker.onmessageerror = (err) => {
clearTimeout(markedWorker.timeout);
let error = 'There was an error in the Worker';
if (err) {
if (err.message) {
error = err.message;
} else {
error = err;
}
}
error = error.replace(/^Uncaught Error: /, '');
$previewElem.classList.add('error');
$htmlElem.classList.add('error');
$lexerElem.classList.add('error');
setParsed(error, error);
setScrollPercent(0);
};
}
if (message.task !== 'defaults') {
markedWorker.working = true;
workerTimeout(0);
}
return new Promise((resolve) => {
message.id = uniqueWorkerMessageId();
workerPromises[message.id] = resolve;
markedWorker.postMessage(message);
});
}
function uniqueWorkerMessageId() {
let id;
do {
id = Math.random().toString(36);
} while (id in workerPromises);
return id;
}
function workerTimeout(seconds) {
markedWorker.timeout = setTimeout(() => {
seconds++;
markedWorker.onerror(
'Marked has taken longer than '
+ seconds
+ ' second'
+ (seconds > 1 ? 's' : '')
+ ' to respond...',
);
workerTimeout(seconds);
}, 1000);
}
markedjs-marked-cdbdc01/docs/demo/index.html 0000664 0000000 0000000 00000014066 15263151172 0021200 0 ustar 00root root 0000000 0000000
Marked Demo
Marked Demo
Loading...
Β·
Response Time:
markedjs-marked-cdbdc01/docs/demo/initial.md 0000664 0000000 0000000 00000002742 15263151172 0021154 0 ustar 00root root 0000000 0000000 Marked - Markdown Parser
========================
[Marked] lets you convert [Markdown] into HTML. Markdown is a simple text format whose goal is to be very easy to read and write, even when not converted to HTML. This demo page will let you type anything you like and see how it gets converted. Live. No more waiting around.
How To Use The Demo
-------------------
1. Type in stuff on the left.
2. See the live updates on the right.
That's it. Pretty simple. There's also a drop-down option above to switch between various views:
- **Preview:** A live display of the generated HTML as it would render in a browser.
- **HTML Source:** The generated HTML before your browser makes it pretty.
- **Lexer Data:** What [marked] uses internally, in case you like gory stuff like this.
- **Quick Reference:** A brief run-down of how to format things using markdown.
Why Markdown?
-------------
It's easy. It's not overly bloated, unlike HTML. Also, as the creator of [markdown] says,
> The overriding design goal for Markdown's
> formatting syntax is to make it as readable
> as possible. The idea is that a
> Markdown-formatted document should be
> publishable as-is, as plain text, without
> looking like it's been marked up with tags
> or formatting instructions.
Ready to start writing? Either start changing stuff on the left or
[clear everything](/demo/?text=) with a simple click.
[Marked]: https://github.com/markedjs/marked/
[Markdown]: http://daringfireball.net/projects/markdown/
markedjs-marked-cdbdc01/docs/demo/preview.html 0000664 0000000 0000000 00000005130 15263151172 0021542 0 ustar 00root root 0000000 0000000
marked.js preview
markedjs-marked-cdbdc01/docs/demo/quickref.md 0000664 0000000 0000000 00000014105 15263151172 0021330 0 ustar 00root root 0000000 0000000 Markdown Quick Reference
========================
This guide is a very brief overview, with examples, of the syntax that [Markdown] supports. It is itself written in Markdown and you can copy the samples over to the left-hand pane for experimentation. It's shown as *text* and not *rendered HTML*.
[Markdown]: http://daringfireball.net/projects/markdown/
Simple Text Formatting
======================
First thing is first. You can use *stars* or _underscores_ for italics. **Double stars** and __double underscores__ for bold. ***Three together*** for ___both___.
Paragraphs are pretty easy too. Just have a blank line between chunks of text.
> This chunk of text is in a block quote. Its multiple lines will all be
> indented a bit from the rest of the text.
>
> > Multiple levels of block quotes also work.
Sometimes you want to include code, such as when you are explaining how `` HTML tags work, or maybe you are a programmer and you are discussing `someMethod()`.
If you want to include code and have new
lines preserved, indent the line with a tab
or at least four spaces:
Extra spaces work here too.
This is also called preformatted text and it is useful for showing examples.
The text will stay as text, so any *markdown* or HTML you add will
not show up formatted. This way you can show markdown examples in a
markdown document.
> You can also use preformatted text with your blockquotes
> as long as you add at least five spaces.
Headings
========
There are a couple of ways to make headings. Using three or more equals signs on a line under a heading makes it into an "h1" style. Three or more hyphens under a line makes it "h2" (slightly smaller). You can also use multiple pound symbols (`#`) before and after a heading. Pounds after the title are ignored. Here are some examples:
This is H1
==========
This is H2
----------
# This is H1
## This is H2
### This is H3 with some extra pounds ###
#### You get the idea ####
##### I don't need extra pounds at the end
###### H6 is the max
Links
=====
Let's link to a few sites. First, let's use the bare URL, like . Great for text, but ugly for HTML.
Next is an inline link to [Google](https://www.google.com). A little nicer.
This is a reference-style link to [Wikipedia] [1].
Lastly, here's a pretty link to [Yahoo]. The reference-style and pretty links both automatically use the links defined below, but they could be defined *anywhere* in the markdown and are removed from the HTML. The names are also case insensitive, so you can use [YaHoO] and have it link properly.
[1]: https://www.wikipedia.org
[Yahoo]: https://www.yahoo.com
Title attributes may be added to links by adding text after a link.
This is the [inline link](https://www.bing.com "Bing") with a "Bing" title.
You can also go to [W3C] [2] and maybe visit a [friend].
[2]: https://w3c.org (The W3C puts out specs for web-based things)
[Friend]: https://facebook.com "Facebook!"
Email addresses in plain text are not linked: test@example.com.
Email addresses wrapped in angle brackets are linked: .
They are also obfuscated so that email harvesting spam robots hopefully won't get them.
Lists
=====
* This is a bulleted list
* Great for shopping lists
- You can also use hyphens
+ Or plus symbols
The above is an "unordered" list. Now, on for a bit of order.
1. Numbered lists are also easy
2. Just start with a number
3738762. However, the actual number doesn't matter when converted to HTML.
1. This will still show up as 4.
You might want a few advanced lists:
- This top-level list is wrapped in paragraph tags
- This generates an extra space between each top-level item.
- You do it by adding a blank line
- This nested list also has blank lines between the list items.
- How to create nested lists
1. Start your regular list
2. Indent nested lists with two spaces
3. Further nesting means you should indent with two more spaces
* This line is indented with four spaces.
- List items can be quite lengthy. You can keep typing and either continue
them on the next line with no indentation.
- Alternately, if that looks ugly, you can also
indent the next line a bit for a prettier look.
- You can put large blocks of text in your list by just indenting with two spaces.
This is formatted the same as code, but you can inspect the HTML
and find that it's just wrapped in a `` tag and *won't* be shown
as preformatted text.
You can keep adding more and more paragraphs to a single
list item by adding the traditional blank line and then keep
on indenting the paragraphs with two spaces.
You really only need to indent the first line,
but that looks ugly.
- Lists support blockquotes
> Just like this example here. By the way, you can
> nest lists inside blockquotes!
> - Fantastic!
- Lists support preformatted text
You just need to indent an additional four spaces.
Even More
=========
Horizontal Rule
---------------
If you need a horizontal rule you just need to put at least three hyphens, asterisks, or underscores on a line by themselves. You can also even put spaces between the characters.
---
****************************
_ _ _ _ _ _ _
Those three all produced horizontal lines. Keep in mind that three hyphens under any text turns that text into a heading, so add a blank like if you use hyphens.
Images
------
Images work exactly like links, but they have exclamation points in front. They work with references and titles too.
 and ![Happy].
[Happy]: https://wpclipart.com/smiley/happy/simple_colors/smiley_face_simple_green_small.png ("Smiley face")
Inline HTML
-----------
If markdown is too limiting, you can just insert your own crazy HTML. Span-level HTML can *still* use markdown. Block level elements must be separated from text by a blank line and must not have any spaces before the opening and closing HTML.
It is a pity, but markdown does **not** work in here for most markdown parsers.
[Marked] handles it pretty well.
markedjs-marked-cdbdc01/docs/demo/worker.js 0000664 0000000 0000000 00000014623 15263151172 0021051 0 ustar 00root root 0000000 0000000 const versionCache = {};
const gfmCache = new Map();
let currentVersion;
onunhandledrejection = (e) => {
throw e.reason;
};
onmessage = function(e) {
if (e.data.version === currentVersion) {
parse(e);
} else {
loadVersion(e.data.version).then(() => {
parse(e);
});
}
};
function getDefaults() {
if (currentVersion === 'commonmark' || currentVersion === 'gfm') {
return {};
}
const marked = versionCache[currentVersion];
let defaults = {};
if (typeof marked.getDefaults === 'function') {
defaults = marked.getDefaults();
delete defaults.renderer;
} else if ('defaults' in marked) {
for (const prop in marked.defaults) {
if (prop !== 'renderer') {
defaults[prop] = marked.defaults[prop];
}
}
}
return defaults;
}
function mergeOptions(options) {
const defaults = getDefaults();
const opts = {};
const invalidOptions = [
'renderer',
'tokenizer',
'walkTokens',
'extensions',
'highlight',
'sanitizer',
];
for (const prop in defaults) {
opts[prop] = invalidOptions.includes(prop) || !(prop in options)
? defaults[prop]
: options[prop];
}
return opts;
}
function parse(e) {
switch (e.data.task) {
case 'defaults': {
postMessage({
id: e.data.id,
task: e.data.task,
defaults: getDefaults(),
});
break;
}
case 'parse': {
if (currentVersion === 'commonmark' || currentVersion === 'gfm') {
const startTime = new Date();
Promise.resolve(versionCache[currentVersion].parse(e.data.markdown))
.then((parsed) => {
const endTime = new Date();
postMessage({
id: e.data.id,
task: e.data.task,
version: currentVersion,
lexed: '',
parsed,
time: endTime - startTime,
});
})
.catch((err) => {
postMessage({
id: e.data.id,
task: e.data.task,
version: currentVersion,
lexed: '',
parsed: `Error: ${err.message}`,
time: 0,
error: true,
});
});
break;
}
const marked = versionCache[currentVersion];
// marked 0.0.1 had tokens array as the second parameter of lexer and no options
const options = currentVersion.endsWith('@0.0.1') ? [] : mergeOptions(e.data.options);
const startTime = new Date();
const lexed = marked.lexer(e.data.markdown, options);
const lexedList = jsonString(lexed);
const parsed = marked.parser(lexed, options);
const endTime = new Date();
postMessage({
id: e.data.id,
task: e.data.task,
version: currentVersion,
lexed: lexedList,
parsed,
time: endTime - startTime,
});
break;
}
}
}
function jsonString(input, level) {
level = level || 0;
if (Array.isArray(input)) {
if (input.length === 0) {
return '[]';
}
const items = [];
let i;
if (!Array.isArray(input[0]) && typeof input[0] === 'object' && input[0] !== null) {
for (i = 0; i < input.length; i++) {
items.push(' '.repeat(2 * level) + jsonString(input[i], level + 1));
}
return '[\n' + items.join('\n') + '\n]';
}
for (i = 0; i < input.length; i++) {
items.push(jsonString(input[i], level));
}
return '[' + items.join(', ') + ']';
} else if (typeof input === 'object' && input !== null) {
const props = [];
for (const prop in input) {
props.push(prop + ':' + jsonString(input[prop], level));
}
return '{' + props.join(', ') + '}';
} else {
return JSON.stringify(input);
}
}
function fetchMarked(file) {
return () =>
fetch(file)
.then((res) => res.text())
.then((text) => {
const g = globalThis || global;
g.module = { };
try {
// eslint-disable-next-line no-new-func
Function(text)();
} catch {
throw new Error(`Cannot find ${file}`);
}
const marked = g.marked || g.module.exports;
return marked;
});
}
function loadVersion(ver) {
let promise;
if (versionCache[ver]) {
promise = Promise.resolve();
} else if (ver === 'commonmark') {
promise = import('https://cdn.jsdelivr.net/npm/commonmark@0.31.2/+esm')
.then((cm) => {
const reader = new cm.Parser();
const writer = new cm.HtmlRenderer();
versionCache[ver] = {
parse: (markdown) => writer.render(reader.parse(markdown)),
};
});
} else if (ver === 'gfm') {
versionCache[ver] = {
parse: async(markdown) => {
if (gfmCache.has(markdown)) {
return gfmCache.get(markdown);
}
const res = await fetch('https://api.github.com/markdown', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
text: markdown,
mode: 'gfm',
}),
});
const text = await res.text();
if (!res.ok) {
let errorMsg = `HTTP Error ${res.status}`;
try {
const json = JSON.parse(text);
if (json.message) {
errorMsg = json.message;
}
} catch {}
throw new Error(errorMsg);
}
gfmCache.set(markdown, text);
return text;
},
};
promise = Promise.resolve();
} else {
promise = import(ver + '/lib/marked.esm.js')
.catch(fetchMarked(ver + '/marked.min.js'))
.catch(fetchMarked(ver + '/lib/marked.umd.js'))
.catch(fetchMarked(ver + '/lib/marked.js'))
.then((marked) => {
if (!marked) {
throw Error('No marked');
} else if (marked.marked) {
versionCache[ver] = marked.marked;
} else if (marked.default) {
versionCache[ver] = marked.default;
} else if (marked.lexer && marked.parser) {
versionCache[ver] = marked;
} else {
throw new Error('Cannot find marked');
}
});
}
return promise.then(() => {
currentVersion = ver;
}).catch((err) => {
console.error(err);
let errorMsg = 'Cannot load that version of marked';
if (ver === 'commonmark') {
errorMsg = 'Cannot load commonmark';
} else if (ver === 'gfm') {
errorMsg = 'Cannot load gfm';
}
throw new Error(errorMsg);
});
}
markedjs-marked-cdbdc01/docs/favicon.ico 0000664 0000000 0000000 00000162326 15263151172 0020403 0 ustar 00root root 0000000 0000000 `` ¨ f `` ¨, ¨ ΆΑ ¨ ^� h Ϋ h nί ( ` ΐ ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������111�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�����111�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�VVV�<<<�!!!����������������������������������������������������� ��όόό�����������������������������������������������������������������������������������������utu����mmm���������������������������������������������������������χχχ�βββ�ΕΕΕ��`_`�������������������������������������������������ΖΖΖ�������������������������������������������������������������������������������������������������FFF�ώώώ���������������������������������������������������������������������ϊϊϊ�κκκ�mmm�����������������������������������������������zzz�σσσ�����������������������������������������������������������������������������������������ΉΉΉ����888�σσσ���������������������������������������������������������������������������������ΕΕΕ�>>>���������������������������������������������������|||�υυυ�����������������������������������������������������������������ΘΘΘ����'''�δδδ�������������������������������������������������������������������������������������οοο�:::���������������������������������������������������¬¬¬�������������ωωω�|||�|||�|||�|||�|||�|||�|||�|||�|||�|||�|||�|||�hhh�
����ΨΨΨ���������������������ϊϊϊ��|||�|||�|||�|||��²²²�μμμ���������������������������������ήήή�555���������������������������������������������������������������υυυ�����������������
�ΜΜΜ���������������������ώώώ�������
���ξξξ�������������������������ώώώ�΅΅΅�������������������������������������������������<<<�δδδ�������������χχχ�888�����������������΅΅΅�������������������������>>>���������BBB�ΡΡΡ�������������������������ϋϋϋ�>>>����������������������������sss�δδδ�ΰΰΰ�ΰΰΰ�ΰΰΰ�ΰΰΰ�δδδ�����bbb�ΦΦΦ�ζζζ�ζζζ�ζζζ�ζζζ�ζζζ�ζζζ�ζζζ�ρρρ�ώώώ�������������ωωω�NMN������������������ώώώ���������������������gfg����������'''�ααα�������������������������ΘΘΘ���������������������������%%%�γγγ�������������������������ρρρ�@@@��+++�φφφ�����������������������������������������������������όόό�ttt�����������������hgh�ώώώ��������������������������������ttt�ϋϋϋ���������������������πππ�%%%��������������������������###�ΰΰΰ�������������������������οοο�===��111�ρρρ��������������������������������������������������������������������������666�ύύύ���������������������»»»������������ξξξ���������������������ψψψ�XXX���������������������������qqq�����������������������������```�¨¨¨�ͺͺͺ�ͺͺͺ�ͺͺͺ�ͺͺͺ�ͺͺͺ�ͺͺͺ�ͺͺͺ�ͺͺͺ�«««�ΏΏΏ�ϊϊϊ���������°°°�"""�����������������ύύύ�������������������������
�����������¦₯¦���������������������ύύύ�vvv����������������������������
�
�
�
�
�
������� � � � � � � � � ��ccc�ώώώ�����χχχ�θθθ�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�QPQ��������ηηη���������������������έέέ������������fff�������������������������
���������������������������������������������������ζζζ���������������������������������������������rrr��������ΏΏΏ���������������������ιιι�000�����������UUU���������������������������������������������������������������������������###�ϊϊϊ��������������������������������������������������������������������������ςςς�>>>�����������UUU�������������������������‘‘‘����������������������������������)))�GGG�III�III�:::�����???�MMM�MMM�MMM�MMM�MMM�[[[�ΘΘΘ�������������������������������������������������···��������ggg�������������������������VVV�����������___����������������������������������������������������������EEE�δδδ�σσσ�τττ�τττ�ξξξ����KKK�πππ�υυυ�υυυ�υυυ�υυυ�υυυ�ωωω�����������������γγγ�ΐΐΐ�ΐΐΐ�ΐΐΐ�ΐΐΐ�ΐΐΐ�ΐΐΐ�ΐΐΐ�ΐΐΐ��
�������DDD�ώώώ���������������������yyy����������������������������������������������������������������������ώώώ�����������������ΞΞΞ�����������������������������������������������������������������333�ρρρ��������������������������������ααα���������������������ψψψ�WWW����������������������������������όόό�����������������···� ��~~~���������������������������������������������ΎΎΎ�����������������$$$�αΰα���������������������ΔΔΔ����������UUU�ψψψ���������������������ρρρ�---�����������������������������������ΎΎΎ�ΏΏΏ�ΏΏΏ�����444���%%%�±±±�»»»�»»»�»»»�»»»�»»»�»»»�ΒΒΒ�μμμ���������ξξξ������������������ΥΥΥ���������������������γγγ���������!!!�ΙΙΙ�������������������������ΟΟΟ��������������������������������������� �����
��������MMM�ρρρ�����ψψψ�!!!����������������
�ΖΖΖ���������������������������������ΜΜΜ�ώώώ���������������������ώώώ�YYY�����������������������������������������������������ααα�����ωωω�;;;�����������������°°°�������������������������BBB�����"""�YYY�ήέή�������������������������ώώώ�»»»�����������������������������������������������������333�ξξξ�����ύύύ��kjk�kjk�kjk�kjk�kjk�kjk�kjk�kjk�kjk�dcd��������ώώώ���������������������€€€�kjk�rqr��ΝΝΝ�ΰΰΰ�ωωω�����������������������������πππ�@@@�������������������������������������������������KKK��©¨©�¬«¬�ηηη�����������������������������������������������������φφφ�000������\[\�ύύύ�������������������������������������������������������������������������οοο�ccc�������������������������������������������������+++�πππ�������������������������������������������������������������������������KKK������777�ύύύ�����������������������������������������������������������������ώώώ�ξξξ�SSS��������������������������������������������������III�����������������������������������������������������������������������������uuu�������όόό�������������������������������������������������������������ιιι�₯₯₯�&&&����������������������������������������������������ΡΡΡ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ��������ήήή�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�ύύύ�όόό�ϋϋϋ�ΘΘΘ�|||�,,,� ������������������������������������������������������XXX�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�KKK�������KJK�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�:::�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�&&&�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�ηηη�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\�\\\����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������qqq��������jjj��������������������������NNN������������������AAA��
������������������������������������������ΓΓΓ�����������������������������···�����������������
�ϋϋϋ����������������������������������������������+++�κκκ�ώώώ�������������������������������������������ΓΓΓ�����������������������������···�����������������
�ϋϋϋ����������������������������������������������ΜΜΜ���������φφφ�lll�����������������������������������������ΓΓΓ�����������������������������···�����������������
�ϋϋϋ��������������������������������������������
�ΈΈΈ�ώώώ�������������χχχ�III����������������������������������������ΓΓΓ�����������������������������···�����������������
�ϋϋϋ���������������������������������������������ώώώ���������������������ζζζ�<<<���������������������������������������ΓΓΓ�����������������������������···�����������������
�ϋϋϋ�������������������������������������������kkk�ϊϊϊ�����������������������������ΨΨΨ���������������������������������������ΓΓΓ�����������������������������···���������EEE��������
�ύύύ������������������������������������������]]]�φφφ�������������������������������������ΑΑΑ��������������������������������������ΓΓΓ�����������������������������···���������ηηη�@@@�������
�ϋϋϋ�����������������������������������������888�θθθ�����������������������������������������ύύύ��
������������������������������������ΓΓΓ�����������������������������···�������RRR�οοο�����ΚΚΚ�������
�ϋϋϋ����������������������������������������***�ΧΧΧ�������������������������������������������������ύύύ�������������������������������������ΓΓΓ�����������������������������···������666�κκκ���������ώώώ�ΑΑΑ������
�ϋϋϋ����������������������������������������ΖΖΖ���������������������������������������������������������φφφ�ddd�����������������������������������ΓΓΓ�����������������������������···������ΘΘΘ�����������������όόό������
�ϋϋϋ�������������������������������������� � �ώώώ�������������������������������������������������������������λλλ�JJJ����������������������������������ΓΓΓ�����������������������������···�����²²²�ώώώ���������������������ψψψ�```����
�ϋϋϋ���������������������������������������όόό���������������������������������������������������������������������δδδ�555���������������������������������ΓΓΓ�����������������������������···����
�όόό�����������������������������ςςς�HHH���
�ϋϋϋ�������������������������������������eee�τττ�����������������������������������������������������������������������������ΔΔΔ���������������������������������ΓΓΓ�����������������������������···���QQQ�υυυ�������������������������������������ΪΪΪ���
�ϋϋϋ������������������������������������JJJ�σσσ���������������������������������������������������������������������������������ώώώ�ΏΏΏ��������������������������������ΓΓΓ�����������������������������···��???�ννν���������������������������������������������ΎΎΎ��
�ϋϋϋ�����������������������������������$$$�ΙΙΙ�εεε�εεε�εεε�εεε�εεε�εεε�θθθ�όόό�����������������������������ςςς�εεε�εεε�εεε�εεε�εεε�εεε�βββ�zzz�������������������������������ΓΓΓ�����������������������������ΆΆΆ�###�ΡΡΡ�������������������������������������������������ύύύ���ϋϋϋ�����������������������������������
��������:::�βββ��������������������������������������������������������������������ΓΓΓ�����������������������������ΔΔΔ�ΆΆΆ���������������������������������������������������������ωωω�xxx�ύύύ�������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ�����������������������������ωωω�����������������������������������������������������������������ψψψ�����������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ�����������������������������������������������������������������πππ�������������������������������������������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ�������������������������������������������������������������ΏΏΏ�III�ξξξ���������������������������������������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ���������������������������������������������������������βββ�666��mmm�ωωω�����������������������������������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ�����������������������������������������������������τττ�CCC�����ώώώ�������������������������������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ�������������������������������������������������ωωω�qqq������΅΅΅�ώώώ���������������������������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ���������������������������������������������ώώώ�₯₯₯�������"""�ήήή���������������������������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ�����������������������������������������ώώώ�ΏΏΏ�
��������333�ηηη�����������������������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ�����������������������������������������βββ�***����������ddd�χχχ�������������������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ�������������������������������������μμμ�BBB�������������όόό���������������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ���������������������������������χχχ�ggg��������������€€€�ώώώ�����������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������ΓΓΓ�����������������������������ώώώ���������������� �ΡΡΡ�����������������������������������������������!!!�ήήή�����������������������������|||���������������������������������������UUU�ooo�ooo�ooo�ooo�ooo�ooo�ooo�ccc�
����������������$$$�ooo�ooo�ooo�ooo�ooo�ooo�ooo�ooo�:::���������������aaa�ooo�ooo�ooo�ooo�ooo�ooo�ooo�666������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ ( ` ΐ H �������� �
�
��
������������������� �!!!�"""�###�$$$�%%%�&&&�'''�)))�***�+++�,,,�---�000�111�333�444�555�666�777�888�:::�;;;�<<<�===�>>>�???�@@@�AAA�BBB�CCC�DDD�EEE�FFF�GGG�HHH�III�JJJ�KJK�MMM�NMN�NNN�QPQ�RRR�SSS�UUU�VVV�WWW�XXX�YYY�[[[�\[\�\\\�]]]�___�`_`�```�aaa�bbb�ccc�dcd�ddd�eee�fff�gfg�hgh�hhh�jjj�kjk�lll�mmm�ooo�qqq�rqr�rrr�sss�ttt�utu�vvv�xxx�yyy�zzz�|||�~~~�����
�������������������������� �‘‘‘�€€€�₯₯₯�¦₯¦�¨¨¨�©¨©�ͺͺͺ�«««�¬«¬�¬¬¬�����°°°�±±±�²²²�΅΅΅�ΆΆΆ�···�ΈΈΈ�ΉΉΉ�»»»�ΎΎΎ�ΏΏΏ�ΐΐΐ�ΑΑΑ�ΒΒΒ�ΓΓΓ�ΔΔΔ�ΕΕΕ�ΖΖΖ�ΘΘΘ�ΙΙΙ�ΚΚΚ�ΜΜΜ�ΝΝΝ�ΞΞΞ�ΟΟΟ�ΡΡΡ�����ΥΥΥ�ΦΦΦ�ΧΧΧ�ΨΨΨ�ΪΪΪ�έέέ�ήέή�ήήή�ΰΰΰ�αΰα�βββ�γγγ�δδδ�εεε�ζζζ�ηηη�θθθ�ιιι�κκκ�λλλ�μμμ�ννν�ξξξ�οοο�πππ�ρρρ�ςςς�σσσ�τττ�υυυ�φφφ�χχχ�ψψψ�ωωω�ϊϊϊ�ϋϋϋ�όόό�ύύύ�ώώώ����� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � -MMMMMMMMMMMMMMMMMMMMMM -MMMMMMMMMMMM6
άίίίίίίίίίίίίίίίίίίίίίίl eίίίίίίίίίίίίίίΧΒV �ίίίίίίίίίίίίίίίίίίίίίίί @ήίίίίίίίίίίίίίίίίίΪΚe pΣίίίίίίίίίίίίίίίίίίίίίί€ 3Σίίίίίίίίίίίίίίίίίίίί8 qΥίίίίίίίίίίίίίίίί― &ΔίίίίίίήίίίίίίίίίίίίίίΟ4 ίίίΩqqqqqqqqqqqqa »ίίίίίΪtqqqqΜίίίίίίίίΏ0 ίίίΥ ²ίίίίίή
{Ξίίίίίίή
6ΔίίίΧ3 ίίίίίί8 <ΆίίίίίίΫ8 jΔΐΐΐΐΔ~ YΉΖΖΖΖΖΖΖΡήίίίΩG ήίίίίί_ &ΐίίίίίί― $ΓίίίίίίΡ: )Φίίίίίίίίίίίίίάk `ήίίίίί} kΫίίίίίΠ$ "ΐίίίίίίΟ8 -Ρήίίίίίίίίίίίίί 1έίίίίί₯ ΞίίίίίΨO gx
W§Ϊίί! έίίίίί· ίίίίίέm ZήίΧΘΗΗΗΗΗΗΗΗI Ηίίίίί½ ^ίίίίίίw
Ζίίίίίίίίίίίi §ίίίίίΙ, Lίίίίίί "Ϊίίίίίίίίίίί ίίίίί�8 Lίίίίίί 'ACC4
9FFFFFQ―ίίίίίίίίίίίί’ _ίίίίίίM Uίίίίίίz ?ΔΣΤΤΞt EΠΥΥΥΥΥΩίίίίΓ¨¨¨¨¨¨¨¨ >ήίίίίίo ίίίίίίu ήίίίί΄
ίίίίίίίίίίί .Ρίίίίί
ΑίίίίίΨN tάίίίί’ rίίίίίίίίίίί¦ #Αίίίίί¬ LΨίίίίίΡ+ ¦§§/ $₯₯₯₯₯₯ͺΜίίΞ ΈίίίίίΓ °ίίίίίί΅
FΡίΨ �ίίίίίί ²ήίίίίίήP ΑίΩ5 ίίίίίί<