Giter Site home page Giter Site logo

orc / discount Goto Github PK

View Code? Open in Web Editor NEW
843.0 44.0 153.0 1.42 MB

My C implementation of John Gruber's Markdown markup language

Home Page: http://www.pell.portland.or.us/~orc/Code/discount

License: Other

C 48.20% Shell 1.98% Perl 8.17% Makefile 2.36% Roff 19.53% Turing 0.29% CMake 1.93% HTML 2.27% Raku 5.15% BitBake 10.11%
markdown c

discount's Introduction

DISCOUNT is a implementation of John Gruber & Aaron Swartz's
 Markdown markup language.   It implements, as far as I can tell,
all of the language as described in
 <http://daringfireball.net/projects/markdown/syntax>
and passes the Markdown test suite at
<http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip>

DISCOUNT is free software written by Jessica L. Parsons
<[email protected]>; it is released under a BSD-style license
that allows you to do as you wish with it as long as you don't
attempt to claim it as your own work.

Most of the programs included in the DISCOUNT distribution have
manual pages describing how they work.

The file INSTALL describes how to build and install discount

discount's People

Contributors

1e0ng avatar apg avatar binki avatar bobsayshilol avatar chriseppstein avatar dileping avatar ghedo avatar hartzell avatar joshix avatar koenpunt avatar lsegal avatar markpizz avatar mcsinyx avatar mischief avatar mloskot avatar nicolasfella avatar orc avatar oridb avatar podsvirov avatar preshing avatar rcrowley avatar rtomayko avatar sekimura avatar soapgentoo avatar tevo45 avatar timgates42 avatar tmm1 avatar trofi avatar typester avatar yurchor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discount's Issues

Allow HTML comments when HTML is disabled

HTML comments are the only reasonable way to do comments in markdown, so I consider them a core feature that shouldn't ever be disabled. The comments can be stripped from generated HTML. For example, GitHub allows HTML comments and strips them from generated HTML output, just the same as what I have propsed (well they used to not allow them, but now they do).

trying to add a github-flavored-markdown modification

I am looking to add, for my own use for now (doubt many other people want/need this, but if they do then great!) a rule to make discount output closer to github-flavored-markdown (GFM).

In particular, GFM does 3 things.
They are:

  • changes to newline handling
  • git hash extraction
  • Multiple underscores in words

Discount already handles the last case beautifully, and the git hash extraction is fairly git specific, so only the first element is really interesting to me right now. I find the change makes markdown a bit more straightforward with regard to formatting, and in some cases Gruber agrees.

In ruby, github is currently using this code snippet here at line 17:

 # in very clear cases, let newlines become <br /> tags
 text.gsub!(/^[\w\<][^\n]*\n+/) do |x|
     x =~ /\n{2}/ ? x : (x.strip!; x << "  \n")
 end

It appears to be (if my regex parsing is correct) checking for lines that start with a word char, or a <, and end in a newline. If that case matches, then a check is made to see if the next char of the next line is a newline. If not (next line stars with a non-newline char), then it removes the newline and adds two space to the line then appending the newline. This is a pre-pass, so markdown will see the spaces at the end of the line and insert a <br>. This should be a simpler test in the actual markdown parser, if a newline is found, and the next char of the next line is not a newline, then insert a break.

I would think a flag (new flag bit as described on http://www.pell.portland.or.us/~orc/Code/discount/) would make sense so people can enable/disable it as they see fit, especially due to the fact that this modifies markdown behavior and would be unexpected to people looking for full markdown conformance.

I am having a bit of a hard time figuring out the parsing in generate.c though (my C is pretty rusty and was arguably never that great). It seems to me that here is an appropriate place to check for the conditions noted above, but I am confused by the ascii ETX case test. Is there a step before that performing a substitution on newline chars to ETX chars for the sake of not confusing the parser when adding newlines via transformations?

Not clear if this is a bug… Unexpected h2 when using - for lists.

Writing a list of items, I had:

- A
-

With the second part blank for when I figured out what I wanted to put there. To my surprise, it interpreted this as equivalent to:

- A
---------------

In other words, a <h2> heading.

My question is whether you should need at least two dashes to set off that behavior. markdown.pl exhibits this same behavior, so I guess this is according to spec. Still, I don’t really like it. It seems too surprising.

no 2.0.4 tag

2.0.4 needs to be tagged as such for distros to start packaging it.

Triple backtick fencing?

Please add triple backtick as fencing method like GitHub Flavored Markdown (like Pandoc triple tilde).

Additionally, it woul be more awesome if the word after the triple backtick (for example '''ruby) will be treated as class for marking language. (I replaced backticks with apos to prevent GH eat it).

cast to pointer from integer of different size

I'm new to using both github and markdown, so I apologize in advance if this has already been fixed/answered.

When building a project in Xcode that includes markdown, all the uses of the CREATE(x) macro have the warning message "cast to pointer from integer of different size". I tried Googling it to find a fix, but all I can find out is that it's related to 64 bit (I'm running Snow Leopard).

The project is a fork of markdownlive: https://github.com/rentzsch/markdownlive/

The warnings happen in the both the original project's 1.5.4 version and in the latest version of markdown I tested

Backslash getting escaped in <code> elements

Here is a terminal session, where markdown is Discount:

% echo ' <code>\</code> ' | Markdown.pl
<p><code>\</code> </p>

% echo ' <code>\</code> ' | markdown
<p> <code>&lt;/code></p>

Shouldn't add <p> tags inside HTML blocks

Given the following input:

<span>foo</span><br>
<br>
<span>bar</span><br>

discount outputs:

<p><span>foo</span><br></p>

<br>


<p><span>bar</span><br></p>

but other Markdown engines (such as Text::Markdown, sundown and the original Markdown.pl script) output:

<p><span>foo</span><br>
<br>
<span>bar</span><br></p>

pandoc outputs:

<p><span>foo</span><br> <br> <span>bar</span><br></p>

etc...

Would it be possible to align the discount behavior to the one of the Markdown.pl script (and the other engines)?

This was originally reported as Debian bug #656122.

configure.sh ignores --with-* options if --shared is used

Hi,

I've just noticed that if I run ./configure.sh with the --shared option, it ignores the --with-* options:

$ ./configure.sh --with-id-anchor --with-github-tags --with-fenced-code --shared
[...]
$ make
[...]
$ ./markdown -V
markdown: discount 2.1.1.3 DEBUG DL=DISCOUNT

Without --shared

$ ./configure.sh --with-id-anchor --with-github-tags --with-fenced-code
[...]
$ make
[...]
$ ./markdown -V
markdown: discount 2.1.2 DL=DISCOUNT ID-ANCHOR GITHUB-TAGS FENCED-CODE

I did't notice this until I actually tried to use fenced code (after you pointed out that it is supported)

The generated config.h files seem ok:

With --shared:

/*
 * configuration for markdown, generated dom  2 ott 2011, 16.49.53, CEST
 * by ale@PC-Ale
 */
#ifndef __AC_MARKDOWN_D
#define __AC_MARKDOWN_D 1


#define OS_LINUX 1
#define USE_DISCOUNT_DL 1
#define WITH_FENCED_CODE 1
#define WITH_ID_ANCHOR 1
#define WITH_GITHUB_TAGS 1
#define PATH_FIND "/usr/bin/find"
#define DWORD unsigned int
#define WORD unsigned short
#define BYTE unsigned char
#define HAVE_PWD_H 1
#define HAVE_GETPWUID 1
#define HAVE_SRANDOM 1
#define INITRNG(x) srandom((unsigned int)x)
#define HAVE_BZERO 1
#define HAVE_RANDOM 1
#define COINTOSS() (random()&1)
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_FCHDIR 1
#define TABSTOP 4
#define HAVE_MALLOC_H 1
#define PATH_SED "/bin/sed"

#endif/* __AC_MARKDOWN_D */

Without:

/*
 * configuration for markdown, generated dom  2 ott 2011, 16.50.15, CEST
 * by ale@PC-Ale
 */
#ifndef __AC_MARKDOWN_D
#define __AC_MARKDOWN_D 1


#define OS_LINUX 1
#define USE_DISCOUNT_DL 1
#define WITH_FENCED_CODE 1
#define WITH_ID_ANCHOR 1
#define WITH_GITHUB_TAGS 1
#define DWORD unsigned int
#define WORD unsigned short
#define BYTE unsigned char
#define HAVE_PWD_H 1
#define HAVE_GETPWUID 1
#define HAVE_SRANDOM 1
#define INITRNG(x) srandom((unsigned int)x)
#define HAVE_BZERO 1
#define HAVE_RANDOM 1
#define COINTOSS() (random()&1)
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_FCHDIR 1
#define TABSTOP 4
#define HAVE_MALLOC_H 1
#define PATH_FIND "/usr/bin/find"
#define PATH_SED "/bin/sed"

#endif/* __AC_MARKDOWN_D */

Is this normal? Am I doing something wrong?

Fails to configure with o=noexec on /tmp

I'm not sure why I'm getting this error, but confgure.sh is not successful...

$ ./configure.sh
Configuring for [markdown]
Looking for cpp (/lib/cpp) ok
looking for install (/usr/bin/install)
checking the C compiler (cc) oh ick, it looks like gcc
looking for ar (/usr/bin/ar)
looking for ranlib (/usr/bin/ranlib)
checking for "volatile" keyword (found)
checking for "const" keyword (found)
defining WORD & DWORD scalar types ** FAILED **

no script, and enable MKD_EMBED

I want to produce html to supress "<script>...</script>", I can do this with MKD_NOHTML flag support on mkd_compile(),

But how can I do if I want keep the <embed></embed> flag? I tried MKD_EMBED flag, but not work for this.

Images should fallback to links if disabled

Here's my proposed fix:

Given that markdown image syntax is disabled and image syntax is encountered:

  • If it is contained inside a link (e.g. I like the [![GitHub](//github.com/images/modules/header/logo.png) Issues](//github.com/Orc/discount/issues) feature.), ignore image syntax and convert it as such: I like the [GitHub Issues](//github.com/Orc/discount/issues) feature..
  • If it is not contained inside a link (e.g. ![GitHub logo](//github.com/images/modules/header/logo.png)), convert it as such, ignoring the leading exclamation mark: [GitHub logo](//github.com/images/modules/header/logo.png).

P.S. While submitting this issue, I discovered what is possibly GitHub's planned new logo (current is logov3.png, the following is logov4.png):

new GitHub logo

Feature Request: Add TOC ID And Separator Options

I think that this is the commit that changed the behavior. I don't suppose it would be possible for an option to be added to restore the use of the id attribute for anchors, would it?

Relatedly, would it be possible to add another option to specify the character to use in place of non-alphanumeric characters in those anchors. I'm fine with the default "." for new sites, but I have existing sites with links to named anchors that still use "+", and I'd like to be able to use the newer version of discount but not have those links break

Thanks!

inconsistent flag name MKD_NO_EXT

Hello,

The MKD_NO_EXT flag name is not consistent with the other "no" flags, which do not have an underscore after the MKD_NO. Please either (1) remove the underscore after the MKD_NO in MKD_NO_EXT or (2) add an underscore after the MKD_NO in all other "no" flags. 👮

Thanks for your consideration.

Problem with comments in paragraphs.

Here’s a test case:

<!-- 1\. --> Paragraph one.

<!--2\.--> Paragraph two.

Expected output: P1 and P2 should be treated the same way. Probably, both of them should be wrapped in <p>s.

Actual output:

<!-- 1\. --> Paragraph one.


<p><!--2\.--> Paragraph two.</p>

(As for why anyone would generate this input, I was translating a document and numbering paragraphs to help keep track of where I was. For the final output, I tried to just wrap the numbers in <!-- -->s to keep it out of the display version.)

`make install` failed

Hi,

Can you check make install failed issue?

Check the generated Makefile, I notice $(DESTDIR) is undefined, so it has big problem with below lines:

install: $(PGMS) $(DESTDIR)/$(BINDIR) $(DESTDIR)/$(LIBDIR) $(DESTDIR)/$(INCDIR)
    /usr/bin/install -s -m 755 $(PGMS) $(DESTDIR)/$(BINDIR)
    ./librarian.sh install libmarkdown VERSION $(DESTDIR)/$(LIBDIR)
    /usr/bin/install -m 444 mkdio.h $(DESTDIR)/$(INCDIR)

Thanks,
Kuaf

MultiMarkdown has column spanning table cells

Under MultiMarkdown, this input:

| Column 1 | Column 2 | Column 3 | Column 4 |
| -------- | :------: | -------- | -------- |
| No span  | Span across three columns    |||

should produce this output:

<table>
<thead>
<tr>
<th> Column 1 </th>
<th align="center"> Column 2 </th>
<th> Column 3 </th>
<th> Column 4 </th>
</tr>
</thead>
<tbody>
<tr>
<td> No span  </td>
<td align="center" colspan="3"> Span across three columns    </td>
</tr>
</tbody>
</table>

Man, Multi-Markdown tables are crazy complicated, no?

Discount improperly handles mismatched backticks

If Markdown has more closing backticks than opening, characters will get eaten.

"test``" or "``test```" will yield "&lt;code&gt;est&lt;/code&gt;". Similarly, "test```" will produce "<code>st</code>"

errors when making shared object on 64bit machine

node-discount, a javascript binding of discount, fails to install with this error message:

/usr/bin/ld: /usr/local/lib/libmarkdown.a(mkdio.o): relocation R_X86_64_32 against `fgetc' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libmarkdown.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

this comment fixes it by forcing position independent code:

Patch "Makefile.in" in your "discount" build tree, with this diff :

1c1

< CC=@CC@ -I. -L. -fPIC

---

> CC=@CC@ -I. -L.

sorry I couldn't make a clean example, but I don't really understand any of this.

Use <a name=...> for ToC headers

Currently, the MKD_TOC option generates headers that look like <h1 id="name">name</h1>. This is not ideal, since setting arbitrary ids can unintentionally pull in CSS styles. Instead, using a <a name="name"></a> before the <h1> produces the same effect without the side-effect:

diff --git a/generate.c b/generate.c
index 512d354..c148573 100644
--- a/generate.c
+++ b/generate.c
@@ -1312,13 +1312,12 @@ text(MMIOT *f)
 static void
 printheader(Paragraph *pp, MMIOT *f)
 {
-    Qprintf(f, "<h%d", pp->hnumber);
     if ( f->flags & MKD_TOC ) {
-       Qprintf(f, " id=\"", pp->hnumber);
+       Qprintf(f, "<a name=\"");
        mkd_string_to_anchor(T(pp->text->text), S(pp->text->text), Qchar, f, 1);
-       Qchar('"', f);
+       Qprintf(f, "\"></a>\n");
     }
-    Qchar('>', f);
+    Qprintf(f, "<h%d>", pp->hnumber);
     push(T(pp->text->text), S(pp->text->text), f);
     text(f);
     Qprintf(f, "</h%d>", pp->hnumber);

Problem parsing alignment on tables

When the table bellow is feed to discount the last column instead of been centered get's right aligned and the middle column that should be right aligned are not.

Left align Right align Center align
This This This
column column column
will will will
be be be
left right center
aligned aligned aligned

Discount no longer builds

Hi David

I was trying to pull in discount as a submodule for a couple of OS X projects but the project no longer builds.
See the following commit 07c1092

/* the standard collection of tags are built and sorted when
10 * discount is configured, so all we need to do is pull them
11 * in and use them.
12 *
13 * Additional tags still need to be allocated, sorted, and deallocated.
14 */
15 #include "blocktags"

blocktags doesn't seem to be in in the repository.

Thanks

Jonathan

PHP Markdown Extra-style Table Bug

Per http://michelf.com/projects/php-markdown/extra/#table this input:

| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |

should produce this output:

<table>
<thead>
<tr>
  <th>First Header</th>
  <th>Second Header</th>
</tr>
</thead>
<tbody>
<tr>
  <td>Content Cell</td>
  <td>Content Cell</td>
</tr>
<tr>
  <td>Content Cell</td>
  <td>Content Cell</td>
</tr>
</tbody>
</table>

Instead it produces the following:

<table>
<thead>
<tr>
<th></th>
<th> First Header  </th>
<th> Second Header </th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td> Content Cell  </td>
<td> Content Cell  |</td>
</tr>
<tr>
<td></td>
<td> Content Cell  </td>
<td> Content Cell  |</td>
</tr>
</tbody>
</table>

Notice that it has empty <th>/<td> cells at the start and an extraneous | left over at the end of the content cell.

Linking against discount in 64 bit linux

I have a problem with PIC when compiling against the discount shared library in 64 bit ubuntu. My compiler informs me that I should recompile with -fPIC

that makes sense, but there's no configure flag switch to do that. So I had to open up the makefile it generated and just add -fPIC to the CC command.

Anyway we could... just make that a configure switch?

I tried to hack it but I quickly became baffled by your configure scripts setup :)

~ Anders

Garbage characters

While playing around, I noticed that I would sometimes get garbage at the end of my string:

#include <mkdio.h>
#include <stdio.h>
#include <string.h>

int main(int argc, const char *argv[])
{
    char *buf, *s = "lol <script>alert('hello, *world*')</script> lol";
    MMIOT *doc = mkd_string(s, strlen(s), 0);
    mkd_compile(doc, MKD_NOHTML);
    mkd_document(doc, &buf);
    printf("%s\n", buf);
    mkd_cleanup(doc);
    return 0;
}

produces <p>lol &lt;script>alert(&lsquo;hello, <em>world</em>&rsquo;)&lt;/script> lol</p>Áð - note the final characters. This bug is kind of hard to isolate; it disappears if I put the MKD_NOHTML flag in the mkd_string function, or if I change a couple characters in the input string. Maybe I'm just doing something wrong with the pointers (I don't actually know C).

Link in heading is crashing toc...

If there is a link in a heading and one generates a toc, discount will crash in generate.c / printlinkyref.
The reason is probably a not fully initialized MMIOT, since printlinkyref is accessing f->cb and this is NULL.

Cheers, richi

Trailing double space breaks smart quoting

The following input (with two trailing spaces on the first line):

"one"  
two

Is producing this output:

<p>&ldquo;one"<br/>
two</p>

The expected output is:

<p>&ldquo;one&rdquo;<br/>
two</p>

For some reason the double trailing spaces are tripping up the smart quotes conversion.

Referencing a footnote/endnote multiple times

Currently, discount seems to support only one mention of a labelled footnote; Subsequent footnotes are ignored. Instead, they should point to the footnote/endnote with the same label and the footnote should have multiple links back to all mentions.

Change in TOC output from Discount 2.0.7 -> 2.1.6

I don't actually think this is a bug, but I wanted to verify that this change in behavior is expected.

Input:

# Level 1

## Level 2

TOC output in Discount 2.0.7:

<ul>
 <li><a href="#Level.1">Level 1</a></li>
 <li><ul>
  <li><a href="#Level.2">Level 2</a></li>
 </ul></li>
</ul>

TOC output in Discount 2.1.6:

<ul>
 <li><a href="#Level.1">Level 1</a>
 <ul>
  <li><a href="#Level.2">Level 2</a></li>
 </ul>
 </li>
</ul>

Both of the above outputs pass W3C HTML validation.

The release notes for Discount 2.1.3 indicate what appears to be the behavior change demonstrated above:

The table of contents code was apparently generating bad html (something I never noticed, because I never use that feature, alas!) but Stefano D'Angelo contributed a patch to clean up the generated html to make it correct.

Could you confirm that this change in output is expected?

Feature request: lang="xx"

Discount already supports creating <span>s and <div>s with the class: etc. formatting of markdown links. Why not also support the lang attribute? Proposed usage:

Input:

[Hello][en] & [こんにちは][jp]
[en]: lang:en
[jp]: lang:jp

Output:

<p><span lang="en">Hello</span> &amp; <span lang="jp">こんにちは</span></p>

It would be handy for me at least.

mkd_cleanup signature is inconsistent.

generated mkdio.h features int mkd_cleanup(MMIOT_) but implementation file resource.c defines void mkd_cleanup(MMIOT_), resulting in the return value being random.

Additionally, the documentation lacks details about the return value, which may confuse users into thinking that it behaves similary to other mkd functions (returning 0 on success).

Support for HTML5 Tags

There is a project that uses discount called rdiscount - https://github.com/rtomayko/rdiscount/

It uses your lib through Ruby. However there is this issue with support for HTML5 tags. Currently HTML5 tags like

are wrapped in

tags. There is already an issue open for this on rdiscount: https://github.com/rtomayko/rdiscount/issues#issue/21

However I was able to track the issue to discount sources ( https://github.com/rtomayko/rdiscount/issues#issue/21/comment/714629 ).

I was wondering if this feature/support should be introduced here itself. If you could give me a little guidance as to how to go about this feature -- like whether html5 support should be optional or exposed through an option -- I would be willing to work on a patch for this.

Support markdown="1" in HTML tags

Markdown Extras supports adding the attribute markdown="1" to verbatim HTML tags to allow markdown to be used within this HTML tags. While discount covers many use cases for arbitrary HTML with its > %classname% syntax, there are some situations where this attribute is useful.

Support adjacent > %classname% blocks

Currently, it seems to be impossible to write markdown with two adjacent > %classname% blocks.

> %classname%
> content for first block

> %classname%
> content for second block

results in

<div class="classname"><p>content for first block</p>

<p>%classname%
content for second block</p></div>

Is there a workaround to achieve this without inserting visible markup/text between the blocks?

Feature request: HTML 4 style void elements

Unless I'm mistaken void elements in Discount are closed in XHTML style (e.g., <img /> rather than <img>). Maybe I shouldn't care, but I prefer the HTML style and I would like to be able to get it in Discount.

Ideally it would be nice to be able to flip between > closings and /> at runtime, but at the moment, I'm just tinkering with a configuration (one-time) switch. (Perhaps a default of XHTML style, but --enable-HTML or the like for the alternative choice.) The tags I see that are relevant are <hr>, <img> (both in generate.c) and <link> in mkd2html.c.

Some questions:

  • Would you be willing to accept a patch with some form of this?
  • Do you have any suggestions about how best to handle it?
  • Is this already implemented somewhere and I'm just missing it?

Thanks.

Don't support gdb debug with pipe input

Hi David,

I'm trying to debug discount for fully understanding design principle. I prefer gdb debug with pipe input, since I want to dig into more from simple unit test, e.g. sh ./tests/header.t. Actually below is testing procedure:

$ echo "#" |./markdown
<p>#</p>

So with gdb tool, I must do (refer to http://stackoverflow.com/questions/8422259/gdb-debugging-with-piped-input-not-arguments):

  1. echo "#" > test_header_file1.txt
  2. gdb ./markdown
  3. b main.c:main
  4. run < test_header_file1.txt

The issue was it did not work as you image, and exit program in below code:

163                 if ( argc && !freopen(argv[0], "r", stdin) ) {
164                     perror(argv[0]);
165                     exit(1);
166                 }

Can you reproduce this issue on your box?

Note: I change main.o, pgm_options.o with -g.

thanks and regards,
njman

Support for footnotes

I was wondering if you have any plans for supporting "pure" (non-link) footnotes. I am aware that this is not part of the original Markdown "spec", but you can find these in many extensions. I'd say even John (G) is using some sort of extension for its own blog that supports footnotes.

As far as I can tell the common syntax for footnotes is:


Some text with a footnote[^1] and some more text

[^1]: this is the footnote referenced above

The generated HTML seems to depend from extension to extension. Two of the Python markdown libs are generating something like


<sup><a> for the reference

and a block:


<div>
<ol>
<li>footnote
</ol>
</div>

Any thoughts?

AC_CHECK_FUNCS is broken in Clang 4

The programs generated by AC_CHECK_FUNCS break on OS X with Clang:

looking for the strcasecmp function
ngc5493.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^~~~
ngc5493.c:4:5: warning: implicitly declaring library function 'strcasecmp' with type 'int (const char *, const char *)'
    strcasecmp();
    ^
ngc5493.c:4:5: note: please include the header <strings.h> or explicitly provide a declaration for 'strcasecmp'
ngc5493.c:4:16: error: too few arguments to function call, expected 2, have 0
    strcasecmp();
    ~~~~~~~~~~ ^
2 warnings and 1 error generated.
offending command was:
main()
{

    strcasecmp();
}

Support arbitrary-starting point ordered lists

No other Markdown HTML converters support this, and rightly so, as it involves having CSS output as well as HTML output. I have two proposed implementations. The following is some example markdown with arbitrary-starting point lists.

Adventure Stuff
===============

Wilderness Survival Guide
-------------------------

&hellip;

32. Bring a knife.
33. Don't forget your AK!
34. Bring a phone with a solar battery charger.
35. Pack a week's worth of food and water.

Driving Directions to Mt. Doom
------------------------------

&hellip;

842. Take a left and drive straight for 1 kilometer.
843. Turn right and continue for 300 meters.
844. You have reached your destination!

Implementation one: Have a common discount-arbitrary-ol CSS class and assign it to every ordered list element whose first list item is not one. Give each of these ordered lists a unique ID (possibly discount-arbitrary-ol-1 or a random GUID) and set the starting point for them in CSS using counter-reset. The HTML and CSS output for implementation one is as follows:

HTML output:

<h1>Adventure Stuff</h1>
<h2>Wilderness Survival Guide</h2>
<p>&hellip;</p>
<ol class="discount-arbitrary-ol" id="discount-arbitrary-ol-1">
    <li>Bring a knife.</li>
    <li>Don't forget your AK!</li>
    <li>Bring a phone with a solar battery charger.</li>
    <li>Pack a week's worth of food and water.</li>
</ol>
<h2>Driving Directions to Mt. Doom</h2>
<p>&hellip;</p>
<ol class="discount-arbitrary-ol" id="discount-arbitrary-ol-2">
    <li>Take a left and drive straight for 1 kilometer.</li>
    <li>Turn right and continue for 300 meters.</li>
    <li>You have reached your destination!</li>
</ol>

CSS output:

.discount-arbitrary-ol {
    counter-reset: discount-arbitrary-ol-item;
    list-style: none;
}
.discount-arbitrary-ol li {
    counter-increment: discount-arbitrary-ol-item;
}
.discount-arbitrary-ol li:before {
    content: counter(discount-arbitrary-ol-item) ". ";
}
#discount-arbitrary-ol-1 {
    counter-reset: discount-arbitrary-ol-item 31;
}
#discount-arbitrary-ol-2 {
    counter-reset: discount-arbitrary-ol-item 841;
}

Alternatively, without using CSS, implementation one can be done by using the deprecated start attribute on ordered list elements.

Implementation two: For every ordered list element whose list items are not an integral sequence starting at one (i.e. any sequence that doesn't start at one or skips numbers), assign the ordered list element a discount-arbitrary-ol class, and every list item a data-item-number attribute representing their number. The HTML and CSS output for implementation two is as follows (the numbers of the example markdown lists have been changed to 32, 23, 74, and 95 for the first list, and 142, 543, and 844 for the second)

HTML output:

<h1>Adventure Stuff</h1>
<h2>Wilderness Survival Guide</h2>
<p>&hellip;</p>
<ol class="discount-arbitrary-ol">
    <li data-item-number="32">Bring a knife.</li>
    <li data-item-number="23">Don't forget your AK!</li>
    <li data-item-number="74">Bring a phone with a solar battery charger.</li>
    <li data-item-number="95">Pack a week's worth of food and water.</li>
</ol>
<h2>Driving Directions to Mt. Doom</h2>
<p>&hellip;</p>
<ol class="discount-arbitrary-ol">
    <li data-item-number="142">Take a left and drive straight for 1 kilometer.</li>
    <li data-item-number="543">Turn right and continue for 300 meters.</li>
    <li data-item-number="844">You have reached your destination!</li>
</ol>

CSS output (constant):

.discount-arbitrary-ol {
    list-style: none;
}
.discount-arbitrary-ol li:before {
    content: attr(data-item-number) ". ";
}

Alternatively, without using CSS, implementation two can be done by using the deprecated value attribute on list item elements. Consecutive non-skipping list items wouldn't need explicit values either.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.