forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This also starts compiling it in the same manner as linenoise, it's just bundled with librustrt directly, and we export just a few symbols out of it.
- Loading branch information
1 parent
9705399
commit 342f829
Showing
27 changed files
with
5,472 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.o | ||
libsundown.so* | ||
sundown | ||
smartypants | ||
*.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Contributing to Sundown | ||
======================= | ||
|
||
Do not. | ||
|
||
Unfortunately, Sundown is currently frozen as we're working with the Reddit, StackOverflow and Meteor developers to design a formal Markdown standard and parser that will supersede Sundown in all these websites (and in GitHub, of course). Our goal is to deprecate Sundown altogether before the end of the year. | ||
|
||
The new parser will be smaller, faster, safer and most importantly, more consistent. | ||
|
||
Please stay tuned. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Makefile | ||
|
||
# Copyright (c) 2009, Natacha Porté | ||
# | ||
# Permission to use, copy, modify, and distribute this software for any | ||
# purpose with or without fee is hereby granted, provided that the above | ||
# copyright notice and this permission notice appear in all copies. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
|
||
DEPDIR=depends | ||
|
||
# "Machine-dependant" options | ||
#MFLAGS=-fPIC | ||
|
||
CFLAGS=-c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml | ||
LDFLAGS=-g -O3 -Wall -Werror | ||
CC=gcc | ||
|
||
|
||
SUNDOWN_SRC=\ | ||
src/markdown.o \ | ||
src/stack.o \ | ||
src/buffer.o \ | ||
src/autolink.o \ | ||
html/html.o \ | ||
html/html_smartypants.o \ | ||
html/houdini_html_e.o \ | ||
html/houdini_href_e.o | ||
|
||
all: libsundown.so sundown smartypants html_blocks | ||
|
||
.PHONY: all clean | ||
|
||
# libraries | ||
|
||
libsundown.so: libsundown.so.1 | ||
ln -f -s $^ $@ | ||
|
||
libsundown.so.1: $(SUNDOWN_SRC) | ||
$(CC) $(LDFLAGS) -shared -Wl $^ -o $@ | ||
|
||
# executables | ||
|
||
sundown: examples/sundown.o $(SUNDOWN_SRC) | ||
$(CC) $(LDFLAGS) $^ -o $@ | ||
|
||
smartypants: examples/smartypants.o $(SUNDOWN_SRC) | ||
$(CC) $(LDFLAGS) $^ -o $@ | ||
|
||
# perfect hashing | ||
html_blocks: src/html_blocks.h | ||
|
||
src/html_blocks.h: html_block_names.txt | ||
gperf -N find_block_tag -H hash_block_tag -C -c -E --ignore-case $^ > $@ | ||
|
||
|
||
# housekeeping | ||
clean: | ||
rm -f src/*.o html/*.o examples/*.o | ||
rm -f libsundown.so libsundown.so.1 sundown smartypants | ||
rm -f sundown.exe smartypants.exe | ||
rm -rf $(DEPDIR) | ||
|
||
|
||
# dependencies | ||
|
||
include $(wildcard $(DEPDIR)/*.d) | ||
|
||
|
||
# generic object compilations | ||
|
||
%.o: src/%.c examples/%.c html/%.c | ||
@mkdir -p $(DEPDIR) | ||
@$(CC) -MM $< > $(DEPDIR)/$*.d | ||
$(CC) $(CFLAGS) -o $@ $< | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
CFLAGS=/O2 /EHsc /I"src/" /I"examples"/ /I"html"/ | ||
CC=cl | ||
|
||
SUNDOWN_SRC=\ | ||
src\markdown.obj \ | ||
src\stack.obj \ | ||
src\buffer.obj \ | ||
src\autolink.obj \ | ||
html\html.obj \ | ||
html\html_smartypants.obj \ | ||
html\houdini_html_e.obj \ | ||
html\houdini_href_e.obj | ||
|
||
all: sundown.dll sundown.exe | ||
|
||
sundown.dll: $(SUNDOWN_SRC) sundown.def | ||
$(CC) $(SUNDOWN_SRC) sundown.def /link /DLL $(LDFLAGS) /out:$@ | ||
|
||
sundown.exe: examples\sundown.obj $(SUNDOWN_SRC) | ||
$(CC) examples\sundown.obj $(SUNDOWN_SRC) /link $(LDFLAGS) /out:$@ | ||
|
||
# housekeeping | ||
clean: | ||
del $(SUNDOWN_SRC) | ||
del sundown.dll sundown.exe | ||
del sundown.exp sundown.lib | ||
|
||
# generic object compilations | ||
|
||
.c.obj: | ||
$(CC) $(CFLAGS) /c $< /Fo$@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
Sundown | ||
======= | ||
|
||
`Sundown` is a Markdown parser based on the original code of the | ||
[Upskirt library](http://fossil.instinctive.eu/libupskirt/index) by Natacha Porté. | ||
|
||
Features | ||
-------- | ||
|
||
* **Fully standards compliant** | ||
|
||
`Sundown` passes out of the box the official Markdown v1.0.0 and v1.0.3 | ||
test suites, and has been extensively tested with additional corner cases | ||
to make sure its output is as sane as possible at all times. | ||
|
||
* **Massive extension support** | ||
|
||
`Sundown` has optional support for several (unofficial) Markdown extensions, | ||
such as non-strict emphasis, fenced code blocks, tables, autolinks, | ||
strikethrough and more. | ||
|
||
* **UTF-8 aware** | ||
|
||
`Sundown` is fully UTF-8 aware, both when parsing the source document and when | ||
generating the resulting (X)HTML code. | ||
|
||
* **Tested & Ready to be used on production** | ||
|
||
`Sundown` has been extensively security audited, and includes protection against | ||
all possible DOS attacks (stack overflows, out of memory situations, malformed | ||
Markdown syntax...) and against client attacks through malicious embedded HTML. | ||
|
||
We've worked very hard to make `Sundown` never crash or run out of memory | ||
under *any* input. `Sundown` renders all the Markdown content in GitHub and so | ||
far hasn't crashed a single time. | ||
|
||
* **Customizable renderers** | ||
|
||
`Sundown` is not stuck with XHTML output: the Markdown parser of the library | ||
is decoupled from the renderer, so it's trivial to extend the library with | ||
custom renderers. A fully functional (X)HTML renderer is included. | ||
|
||
* **Optimized for speed** | ||
|
||
`Sundown` is written in C, with a special emphasis on performance. When wrapped | ||
on a dynamic language such as Python or Ruby, it has shown to be up to 40 | ||
times faster than other native alternatives. | ||
|
||
* **Zero-dependency** | ||
|
||
`Sundown` is a zero-dependency library composed of 3 `.c` files and their headers. | ||
No dependencies, no bullshit. Only standard C99 that builds everywhere. | ||
|
||
Credits | ||
------- | ||
|
||
`Sundown` is based on the original Upskirt parser by Natacha Porté, with many additions | ||
by Vicent Marti (@vmg) and contributions from the following authors: | ||
|
||
Ben Noordhuis, Bruno Michel, Joseph Koshy, Krzysztof Kowalczyk, Samuel Bronson, | ||
Shuhei Tanuma | ||
|
||
Bindings | ||
-------- | ||
|
||
`Sundown` is available from other programming languages thanks to these bindings developed | ||
by our awesome contributors. | ||
|
||
- [Redcarpet](https://github.com/vmg/redcarpet) (Ruby) | ||
- [RobotSkirt](https://github.com/benmills/robotskirt) (Node.js) | ||
- [Misaka](https://github.com/FSX/misaka) (Python) | ||
- [ffi-sundown](https://github.com/postmodern/ffi-sundown) (Ruby FFI) | ||
- [Sundown HS](https://github.com/bitonic/sundown) (Haskell) | ||
- [Goskirt](https://github.com/madari/goskirt) (Go) | ||
- [Upskirt.go](https://github.com/buu700/upskirt.go) (Go) | ||
- [MoonShine](https://github.com/brandonc/moonshine) (.NET) | ||
- [PHP-Sundown](https://github.com/chobie/php-sundown) (PHP) | ||
- [Sundown.net](https://github.com/txdv/sundown.net) (.NET) | ||
|
||
Help us | ||
------- | ||
|
||
`Sundown` is all about security. If you find a (potential) security vulnerability in the | ||
library, or a way to make it crash through malicious input, please report it to us, | ||
either directly via email or by opening an Issue on GitHub, and help make the web safer | ||
for everybody. | ||
|
||
Unicode character handling | ||
-------------------------- | ||
|
||
Given that the Markdown spec makes no provision for Unicode character handling, `Sundown` | ||
takes a conservative approach towards deciding which extended characters trigger Markdown | ||
features: | ||
|
||
* Punctuation characters outside of the U+007F codepoint are not handled as punctuation. | ||
They are considered as normal, in-word characters for word-boundary checks. | ||
|
||
* Whitespace characters outside of the U+007F codepoint are not considered as | ||
whitespace. They are considered as normal, in-word characters for word-boundary checks. | ||
|
||
Install | ||
------- | ||
|
||
There is nothing to install. `Sundown` is composed of 3 `.c` files (`markdown.c`, | ||
`buffer.c` and `array.c`), so just throw them in your project. Zero-dependency means | ||
zero-dependency. You might want to include `render/html.c` if you want to use the | ||
included XHTML renderer, or write your own renderer. Either way, it's all fun and joy. | ||
|
||
If you are hardcore, you can use the included `Makefile` to build `Sundown` into a dynamic | ||
library, or to build the sample `sundown` executable, which is just a commandline | ||
Markdown to XHTML parser. (If gcc gives you grief about `-fPIC`, e.g. with MinGW, try | ||
`make MFLAGS=` instead of just `make`.) | ||
|
||
License | ||
------- | ||
|
||
Permission to use, copy, modify, and distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
|
||
<!-- Local Variables: --> | ||
<!-- fill-column: 89 --> | ||
<!-- End: --> |
Oops, something went wrong.